# Number Guess game using Easygui
import random, easygui
secret = random.randint(1, 100) #pick a secret number
guess = 0
tries = 0
easygui.msgbox("""harry,我们将进行猜数字游戏1-100""")
# keep trying until they guess it or run out of turns
while guess != secret and tries < 6:
guess = int(easygui.enterbox("你想猜多少?")) # get the guess
if guess < secret:
easygui.msgbox(str(guess) + " 太小了!")
elif guess > secret:
easygui.msgbox(str(guess) + " 太大了!")
else:
easygui.msgbox("天选之人")
if guess == secret:
easygui.msgbox("天选之人!")
else:
easygui.msgbox("No more guesses! Better luck next time, matey!")
easygui.msgbox("The secret number was "+ str(secret))
harry -猜数字游戏窗口版
最新推荐文章于 2024-08-09 16:47:53 发布