• python_day1


    01

    age_of_oldboy = 56
    for i in range(3):
        guess_age = int(input("guess age:") )
        if guess_age == age_of_oldboy :
            print("yes, you got it. ")
            break
        elif guess_age > age_of_oldboy:
            print("think smaller...")
        else:
            print("think bigger!")
    else:
        print("you have tried too many times..fuck off")
    

     02

    age_of_oldboy = 56
    
    count = 0
    while count <3:
        guess_age = int(input("guess age:") )
        if guess_age == age_of_oldboy :
            print("yes, you got it. ")
            break
        elif guess_age > age_of_oldboy:
            print("think smaller...")
        else:
            print("think bigger!")
        count +=1
    else:
        print("you have tried too many times..fuck off")
    

     03

     1 age_of_oldboy = 56
     2 
     3 count = 0
     4 while count <3:
     5     guess_age = int(input("guess age:") )
     6     if guess_age == age_of_oldboy :
     7         print("yes, you got it. ")
     8         break
     9     elif guess_age > age_of_oldboy:
    10         print("think smaller...")
    11     else:
    12         print("think bigger!")
    13     count +=1
    14     if count == 3:
    15         countine_confirm = input("do you want to keep guessing..?")
    16         if countine_confirm != 'n':
    17             count =0

    04

     1 import getpass
     2 
     3 _username = 'alex'
     4 _password = 'abc123'
     5 username = input("username:")
     6 #password = getpass.getpass("password:")
     7 password = input("password:")
     8 if _username == username and _password == password:
     9     print("Welcome user {name} login...".format(name=username))
    10 else:
    11     print("Invalid username or password!")

    05

     1 count = 0
     2 while True:
     3     print("count:",count)
     4     count = count +1  #count +=1
     5     if count == 1000:
     6         break
     7 
     8 
     9 for i in range(0,10):
    10     if i <3:
    11         print("loop ",i)
    12     else :
    13         continue
    14     print("hehe...")
    15 
    16 
    17 for i in range(10):
    18     print('----------',i)
    19     for j in range(10):
    20         print(j)
    21         if j >5:
    22             break
  • 相关阅读:
    Centos8 安装mongodb
    java 时间处理
    从技术走向管理李元芳履职记 读书记录
    debian基本操作
    centos8 安装kudu
    k8s api调用示例
    idea other settings
    C# Random生成相同随机数的解决方案
    DropDownList绑定选择数据报错问题
    离谱
  • 原文地址:https://www.cnblogs.com/xieyi-1994/p/11623656.html
Copyright © 2020-2023  润新知