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)
    

     运行结果:

  • 相关阅读:
    box-shadow使用指南
    chrome的input默认样式黄色背景以及选中加粗的边框处理
    Spring AOP执行方法
    Spring JDBC主从数据库访问配置
    JS 命名冲突
    Data truncation: Truncated incorrect DOUBLE value 解决方案
    MySQL DATE_ADD() 函数
    Codeforces Round #340 (Div. 2)
    2020牛客寒假算法基础集训营3
    Codeforces Round #377 (Div. 2)
  • 原文地址:https://www.cnblogs.com/MIS-67/p/9679992.html
Copyright © 2011-2022 走看看