英文词频统计预备,组合数据类型练习

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就知道你是在指明一个列表。元组通常用在使语句或用户定义的函数能够安全的采用一组值的时候,即被使用的元组的值不会改变。元组可以嵌套。

转载于:https://www.cnblogs.com/1257-/p/7565131.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值