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)
    

     运行结果:

  • 相关阅读:
    springboot使用war包部署到外部tomcat
    html只允许输入的数据校验,只允许输入字母汉字数字等
    转:执行ajax加载页面中的js
    php 解析xml 的四种方法(转)
    Php 获取xml中的节点值
    php中DOMDocument简单用法(XML创建、添加、删除、修改)
    PHP对XML文件操作详细
    转载 PHP 程序员学数据结构与算法之《栈》
    php读取二进制流(C语言结构体struct数据文件)的深入解析
    关于php和C语言接口的结构传递问题,udp,tcp通信
  • 原文地址:https://www.cnblogs.com/MIS-67/p/9679992.html
Copyright © 2011-2022 走看看