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

1.实例: 下载一首英文的歌词或文章,将所有,.?!等替换为空格,将所有大写转换为小写,,分隔出一个一个的单词。

英文歌曲:

Big big world-Emilia
I'm a big big girl !
In a big big world !
It's not a big big thing if you leave me.
But I do do feel.
That I too too will miss you much.
Miss you much !
I can see the first leaf falling.
It's so very cold outside.
Like the way I'm feeling inside.
I'm a big big girl !
In a big big world !
It's not a big big thing if you leave me.
But I do do feel.。
That I too too will miss you much.
Miss you much !
Outside it's now raining.
And tears are falling from my eyes.
Why did it have to happen ?
Why did it all have to end ?
I'm a big big girl !
In a big big world !

,.?!等替换为空格:

将所有大写转换为小写:

统计某几个单词出现的次数:

分隔出一个一个的单词:

2.列表实例:由字符串创建一个作业评分列表,做增删改查询统计遍历操作。例如,查询第一个3分的下标,统计1分的同学有多少个,3分的同学有多少个等。

3.简要描述列表与元组的异同

list是处理一组有序项目的数据结构,即你可以在一个列表中存储一个序列的项目。列表中的项目。列表中的项目应该包括在方括号中,这样python就知道你是在指明一个列表。元组通常用在使语句或用户定义的函数能够安全的采用一组值的时候,即被使用的元组的值不会改变。元组可以嵌套。

原文地址:https://www.cnblogs.com/chenhuafei/p/7562070.html