import random
number = random.randint(1, 100)
guess = 0
while guess != number:
guess = int(input("Guess a number between 1 and 100: "))
if guess > number:
print("Too high!")
elif guess < number:
print("Too low!")
else:
print("You got it!")
最后
以上就是沉默酒窝最近收集整理的关于用python写猜数字游戏的全部内容,更多相关用python写猜数字游戏内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复