python--猜数字游戏
程序员文章站
2022-06-16 22:44:11
...
import random
game = random.randint(0,100)
while True:
my = int(input("请输入一个0~100的数:"))
if my == game:
print("恭喜,猜对了!")
break
elif my > game:
print("对不起,猜大了!")
else:
print("对不起,猜小了!")