zoukankan      html  css  js  c++  java
  • 第三周作业——列表,元组,字典

    1.
    strThat = '''Sarah Connor-that girl
    (That girl!)Ow~yeah! Um!Are you talk about me?
    (Um!Yes,I can trust.)
    Red carpet rolling, pockets are swollen
    Still got my friends, and with them I be flowing
    Rocking don't stopping and shopping
    Still coming on strong, I'll be flossy!
    This one's just for you
    I'm taking it to level,too.
    Tell me why you're talking trash
    They talk about that girl on the scene,
    Fusing that gucci on TV.(ah ha)
    That girl with the car
    20 inch rims on the jaguar.(ah ha)
    That girl on the show
    Thinking that bird just like a cock.(ah ha)
    That girl, that girl
    (That...taht...that...taht...that...)
    I take things step by step
    Until there's nothing left
    But the top and it don't stop
    When I sign off, I can hear the beat drop
    No matter what I do, I can't do right by you
    You can chat chat the chadder but it don't matter
    This is for you
    (Ha!Ha!Ha!...)
    They talk about that girl on the scene,
    Fusing that gucci on TV.(ah ha)
    That girl with the car
    20 inch rims on the jaguar.(ah ha)
    That girl on the show
    Thinking that bird just like a cock.(ah ha)
    That girl, that girl
    (That...taht...that...taht...that...)
    (That girl on the scene,fusing that gucci on TV.(ah ha)
    (That girl with the car,20 inch rims on the jaguar)(ah ha)
    (That girl on the scene,fusing that gucci on TV.(ah ha)
    (That...taht...that...taht...that...)
    I will be shining, you'll be crying
    You don't wanna front with me
    On Vina and on MTV
    I'm gonna still be me
    And I will be shining you'll be dying
    You don't wanna  front with me
    Toe to toe on MTV
    I'm gonna still be me
    They talk about that girl on the scene,
    Fusing that gucci on TV.(ah ha)
    That girl with the car
    20 inch rims on the jaguar.(ah ha)
    That girl on the show
    Thinking that bird just like a cock.(ah ha)
    That girl, that girl
    (That...taht...that...taht...that...)
    They talk about that girl on the scene,
    Fusing that gucci on TV.(ah ha)
    That girl with the car
    20 inch rims on the jaguar.(ah ha)
    That girl on the show
    Thinking that bird just like a cock.(ah ha)
    That girl, that girl
    (That...taht...that...taht...that...)
    They talk about that girl.
    -
    '''  
    strList = strThat.lower()
    print(strList)
    for word in strList:
        print(word)
    print(strList.count('girl'))
    strSet = set(strList)
    print(len(strSet),strSet)
    
    strDict = {}
    for word in strSet:
        strDict[word] = strList.count(word)
    
    print(len(strList),strList)
    
    2.
    s = {2,4,6,87,7,8,9,'Tom'}
    print(s)
    s.add('Nancy')
    print(s)
    s.remove(87)
    print(s)
    s1 = {1,2,4,7,5,0,'Tom',3}
    print(s1)
    set1 = s & s1
    print(set1)
    set2 = s| s1
    print(set2)
    set3 = s - s1
    print(set3)
    

     运行结果:

  • 相关阅读:
    单片机4*4按键数码管显示0-9
    netbeans设置语言
    单片机中断的应用
    Linux 命令总结
    vc6.0快捷键大全
    怎么使PUTTY一直连接
    mysql alter 效率
    treeview
    Gitbook
    linux 进程监控软件 supervisor
  • 原文地址:https://www.cnblogs.com/MIS-67/p/9679992.html
Copyright © 2011-2022 走看看