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

    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.

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

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

  • 相关阅读:
    转:BIOS的恢复技术之Top Swap的原理应用
    半硬化树脂PP的型号
    PADS常用画板过程
    ad2014注册出现:注册
    CPU处理多任务——中断与轮询方式比较
    PDS常用快捷键
    方法三破解:Excel工作表保护密码
    【Linux指标】内存篇
    mac apt-get--> Homebrew
    20180113Go匿名函数和闭包
  • 原文地址:https://www.cnblogs.com/zheng01/p/7565058.html
Copyright © 2011-2022 走看看