zoukankan      html  css  js  c++  java
  • 英文词频统计预备,组合数据类型练习

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

  • 相关阅读:
    常用知识点集合
    LeetCode 66 Plus One
    LeetCode 88 Merge Sorted Array
    LeetCode 27 Remove Element
    LeetCode 26 Remove Duplicates from Sorted Array
    LeetCode 448 Find All Numbers Disappeared in an Array
    LeetCode 219 Contains Duplicate II
    LeetCode 118 Pascal's Triangle
    LeetCode 119 Pascal's Triangle II
    LeetCode 1 Two Sum
  • 原文地址:https://www.cnblogs.com/chenhuafei/p/7562070.html
Copyright © 2011-2022 走看看