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

Posted wsxhj

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了英文词频统计预备 组合数据类型练习相关的知识,希望对你有一定的参考价值。

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

big=\'\'\'Oooh
Oooh

Put your make-up on
Get your nails done
Curl your hair
Run the extra mile
Keep it slim so they like you, do they like you?

Get your sexy on
Don\'t be shy, girl
Take it off
This is what you want, to belong, so they like you
Do you like you?

You don\'t have to try so hard
You don\'t have to, give it all away
You just have to get up, get up, get up, get up
You don\'t have to change a single thing

You don\'t have to try, try, try, try
You don\'t have to try, try, try, try
You don\'t have to try, try, try, try
You don\'t have to try
Yooou don\'t have to try

Oooh
Oooh

Get your shopping on, at the mall, max your credit cards
You don\'t have to choose, buy it all, so they like you
Do they like you?

Wait a second,
Why, should you care, what they think of you
When you\'re all alone, by yourself, do you like you?
Do you like you?

You don\'t have to try so hard
You don\'t have to, give it all away
You just have to get up, get up, get up, get up
You don\'t have to change a single thing

You don\'t have to try so hard
You don\'t have to bend until you break
You just have to get up, get up, get up, get up
You don\'t have to change a single thing

You don\'t have to try, try, try, try
You don\'t have to try, try, try, try
You don\'t have to try, try, try, try
You don\'t have to try

You don\'t have to try, try, try, try
You don\'t have to try, try, try, try
You don\'t have to try, try, try, try
You don\'t have to try
Yooou don\'t have to try

Oooh
Oooh

You don\'t have to try so hard
You don\'t have to, give it all away
You just have to get up, get up, get up, get up
You don\'t have to change a single thing

You don\'t have to try, try, try, try
You don\'t have to try, try, try, try
You don\'t have to try
You don\'t have to try

Take your make-up off
Let your hair down
Take a breath
Look into the mirror, at yourself
Don\'t you like you?
Cause I like you\'\'\'
big=big.lower()
for i in \',.?!\':
big.replace(i,\'\')
words=big.split(\' \')
print(words)

print(\'try :\',big.count(\'try\'))
print(\'you :\',big.count(\'You\'))

结果如下:

 

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

 

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

列表可以更改数据,元组无法更改。

列表是可变的数据类型,所以其中的项目应该包括在方括号中,可以添加删除修改项目,元组和列表十分相似,但是元组的数据一旦输入,就无法更改,而且其中的数据是包括在圆括号里面。

 

 

以上是关于英文词频统计预备 组合数据类型练习的主要内容,如果未能解决你的问题,请参考以下文章

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

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

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

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

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

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