python while循环简单例子

i = 1
while True:
    while i <= 3:
        age = int(input("input yout guess age:"))
        if age == 22:
            print("yes!")
        elif age < 22:
            print("no,your guess little!")
        elif age > 22:
            print("no,your guess old!")
        else:
            print("press error!")
        i += 1
    print("you are pig!")
    j = input("continue to guess? >: yes / no")
    if j == "yes":
        i = 1
        print(end = "")
    elif j == "no":
        break
    else:
        print("press error!")

上一篇:阿里云ACA、ACP和ACE认证考试如何选择?有什么区别?


下一篇:sql server 2008学习1–系统数据库