英文词频统计预备,组合数据类型练习
Posted 李庆
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了英文词频统计预备,组合数据类型练习相关的知识,希望对你有一定的参考价值。
1
a=\'\'\'After the Winter - Lenka
When the rain is pourin\' down
And there are snowflakes on your cheeks
When your heart is frozen over
And there is a sea lost sun in weeks
Just remember,
Just remember,
After the winter comes the spring
That is when the blue birds
Starts to sing
And you can always count on this
After the winter comes the spring
When the trees have lost the color
And the sky is full of fears
When you feel you are going under
And your eyes are full of tears
When the bells are all hiding
And you are hiding too
Oh, darling just remember
That everything will soon be new
After the winter comes the spring
That is when the blue birds
Start to use their wings
And you can always count on this
After the winter comes the spring
Just remember,
Just remember,
Just remember,
Just remember,
After the winter comes the spring
That is when the blue birds
Starts to sing
And you can always count on this
After the winter comes the spring
After the winter comes the spring\'\'\'
a=a.lower()
for i in \',.?\':
a=a.replace(i,\'\')
print(a.split(\' \'))
print(\'remember :\',a.count(\'remember\'))
print(\'you :\',a.count(\'you\'))
2
grades
=
list
(
\'12313561325\'
)
for
i
in
range
(
len
(grades)):
grades[i]
=
int
(grades[i])
print
(grades)
print
(grades.index(
3
))
print
(grades.count(
1
))
print
(grades.count(
3
))
3
list是处理一组有序项目的数据结构,即你可以在一个列表中存储一个序列的项目。列表中的项目。列表中的项目应该包括在方括号中,这样python就知道你是在指明一个列表。元组通常用在使语句或用户定义的函数能够安全的采用一组值的时候,即被使用的元组的值不会改变。元组可以嵌套。
以上是关于英文词频统计预备,组合数据类型练习的主要内容,如果未能解决你的问题,请参考以下文章