zoukankan      html  css  js  c++  java
  • python练习

    第三周

    第一题

    list_i=["咖啡","牛奶","咖啡","橘子","苹果","香蕉"]
    print(list_i)
    while True:
        value = input("请输入您要删除的东西:");
        j = 0
        temp = 1
        for i in range(len(list_i)):
            if list_i[j] == value:
                list_i.pop(j)
                temp = 0
            else:
                j += 1
    
        if temp:
            print("没有您要删除的东西")
        print(list_i)
    

    image-20210401130939493

    第二题

    coin=int(input("请输入您的钱币数:"))
    if coin<1500:
        print("您的金额是:",coin)
    else:
        print("您的可乐出来了
    ","剩余金额",coin-1500,"元")
    
    

    image-20210401132117128

    第三题

    a=input("Tell me what your name is.")
    b=input("Tell me where you will go.")
    c=input("Tell me the purpose of travel.")
    d=input("Tell me how long you will stay.")
    print("Name:"+a,"
    ","Destination:"+b,"
    ","Purpose:"+c,"
    ","Length of stay:"+d)
    

    image-20210401132743064

    第四题

    numbers=[273,101,50,200,50,70,150,99,8,1500]
    a=0
    while a<len(numbers):
        print(numbers[a],"是",len(str(numbers[a])),"位数字")
        a=a+1
    
    

    image-20210401133614950

    第五题

    numbers=[273,101,50,200,50,70,150,99]
    b=len(numbers)
    print(numbers)
    print(len(numbers))
    while b:
        a = 0
        if len(str(numbers[a]))>=3:
            print("一百以上的有:", numbers[a])
        a=a+1
        b=b-1
    

    image-20210401134417779

    第六题

    import random
    list=[" Sexiness wears thin after a while and beauty fades, but to be married to a man who makes you laugh every day, ah, now that's a real treat. (Joanne Woodward)",
          "There's a way of transferring funds that is even faster than electronic banking. It's called marriage. (James Holt McGavran)",
          "I've had bad luck with both my wives. The first one left me and the second one didn't.(Patrick Murray)",
          "A good wife always forgives her husband when she's wrong.(Milton Berle)",
          "Marriage is an institution in which a man loses his bachelor's degree and the woman gets her master's.(Socrates)",
          "Marriage is the only war where one sleeps with the enemy.(Anonymous)"
          ]
    from random import choice
    print("-------------------------------------------------
    "
          ,"                    每日一句
    ","-------------------------------------------------
    ")
    print(choice(list))
    

    image-20210401135231495

    第七题

    import random
    l=[random.randint(1,45) for n in range(6)]
    #print(l)
    l.sort(reverse=False)
    print("本期大乐透号码是:
    ",l,"
    恭喜发财!!!
    ")
    
    

    image-20210401141316844

  • 相关阅读:
    Android:在eclipse中快速多行注释的方法
    DB2中若何除去SELECT输入的头信息
    哄骗DB2look重新设立建立优化器访谒操持(1)
    利用DB2look 从头创建优化器访问经营(2)
    运用DB2look重新建立优化器会晤企图(5)
    运用DB2look重新建立优化器访问摒挡(9)
    实例理睬IBM DB2的数据复制、迁移设置装备摆设
    DB2数据库优化的几条根底战略
    使用DB2look从头树立优化器拜候经营(6)
    哄骗DB2look重新创立优化器访谒企图(7)
  • 原文地址:https://www.cnblogs.com/Weber-security/p/14606113.html
Copyright © 2011-2022 走看看