Python入門基礎–猜年齡

Mifen發表於2018-11-26

 

age = 20
while True:
    try:
        guess_age = int(input(`guess age:`))
        if guess_age > age:
            print(`Is bigger`)
        elif guess_age < age:
            print(`Is smaller`)
        elif guess_age == age:
            print(`Great`)
            break
    except:
        print(`Wrong input`)

  

相關文章