欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Python学习day01

程序员文章站 2022-03-25 18:53:13
age = 23 count=0 while count<3: guess_age = int (input("My age:")) if age ==guess_age: print("nice, you got it") break elif age < guess_age: print("gu ......
Python学习day01
age = 23
count=0
while count<3:

    guess_age = int (input("my age:"))
    if age ==guess_age:
        print("nice, you got it")
        break
    elif age < guess_age:
        print("guess bigger!think smaller.")
    else:
        print("guess smaller,think bigger.")
    count=count+1
    if count==3:
        keep=input("\ndo you want to keeping guess?if no,input a n.")
        if keep!="n":
            count=0
print("bey bey!")
view code
age = 23
count=0
while count<3:

    guess_age = int (input("my age:"))
    if age ==guess_age:
        print("nice, you got it")
        break
    elif age < guess_age:
        print("guess bigger!think smaller.")
    else:
        print("guess smaller,think bigger.")
    count=count+1
    if count==3:
        keep=input("\ndo you want to keeping guess?if no,input a n.")
        if keep!="n":
            count=0
print("bey bey!")

https://blog.csdn.net/pythonending/article/details/86325351

2019-01-12 00:08:08