python3
import random
the_number = random.randint(1, 100)
guess = int(input("Guess a number between 1 and 100: "))
while guess != the_number:
if guess > the_number:
print(guess, "was too high. Try again.")
if guess < the_number:
print(guess, "was too low. Try again.")
guess = int(input("Guess again: "))
print(guess, "was the number! You win!")
the_number = random.randint(1, 100)
guess = int(input("Guess a number between 1 and 100: "))
while guess != the_number:
if guess > the_number:
print(guess, "was too high. Try again.")
if guess < the_number:
print(guess, "was too low. Try again.")
guess = int(input("Guess again: "))
print(guess, "was the number! You win!")
上一篇:python4
下一篇:爬楼梯中的人生
声明:以上文章均为用户自行添加,仅供打字交流使用,不代表本站观点,本站不承担任何法律责任,特此声明!如果有侵犯到您的权利,请及时联系我们删除。