用for循环写这段代码

之前用while循环写了一段代码,现在改为用for循环来写,代码如下:

hongtao_age = 38
for i in range(5):
    guess_age = int(input("Please guess the hongtao's age:  "))
    if guess_age == hongtao_age:
        print("================")
        print("Yes!you get it!!Good Bye!!")
        print("================")
        break
    elif guess_age < hongtao_age:
        print("You need guess more.....")
    else:
        print("less you guess..........")
else:
    print("====================================")
    print("You guess too much time!!  Fuck off !!")
    print("====================================")
原文地址:https://www.cnblogs.com/show530/p/12377163.html