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

  • 相关阅读:
    Java合并png图片
    MiniUi遇到的一个Bug或者说坑,以div里面的内容自适应高度
    Javascript/JQuery遇到的bug
    SQL Server将列以分隔符分割后存到临时表
    Java Miniui实现批量上传文件demo 201906221520
    Java MiniUi datagrid加载数据时,如果使用virtualScroll="true",数据多一点可能就会加载不出来
    Java调用存储过程出现Bug,sql语法错误
    Java的jdbc调用SQL Server存储过程Bug201906131120
    Java的jdbc调用SQL Server存储过程Bug201906131119
    用深度优先搜索(DFS)解决多数图论问题
  • 原文地址:https://www.cnblogs.com/Weber-security/p/14606113.html
Copyright © 2011-2022 走看看