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

1.

s='''We don't talk anymore
We don't talk anymore
We don't talk anymore
Like we used to do
We don't laugh anymore
What was all of it for ?
We don't talk anymore
Like we used to do
I just heard you ( ya ) found the one you've been lookin'
The one you been looking for
I wish i would've konwn that wasn't me
Cause even after all this time i still wonder
Why i can't move on ?
Just the way you dance so easliy
Don't wanna know
The kinda dress you're wearin' tonight
If he's holdin' onto you so tight
The way i did before
I overdosed
Should've known your love was game
Now I can't get'cha out of my brain
Ooh it's such a shame
We don't talk anymore
We don't talk anymore
We don't talk anymore
Like we used to do
We don't laugh anymore
What was all of it for ?
We don't talk anymore
Like we used to do'''
s=s.lower()
for i in ',.?':
    s=s.replace(i,' ')
print(s.split(' '))
print(s.count('talk'))
print(s.count('anymore'))

2.

ls=list('2132132132')
for i in range(len(ls)):
ls[i]=int(ls[i])
print(ls)
ls.append(5)
print(ls)
ls.remove(5)
print(ls)
ls.sort()
print(ls)
print(ls.count(1))
print(ls.count(3))
print(ls.index(3))

3.

列表里面的数据是可变的,可增删改插。

元组里面的数据是不可变的,只可增,不可删改

原文地址:https://www.cnblogs.com/zheng01/p/7565058.html