import random x=random.randint(1,100) print(‘-----猜数游戏-----‘) guess=0 while guess!=x: temp=input(‘猜数开始,请输入:‘) guess=int(temp) if guess > x: print(‘大了‘) else : print(‘小了‘) if guess==x: print(‘猜数正确‘) print(‘-----游戏结束-----‘)
原文地址:https://www.cnblogs.com/cylf/p/10567285.html
时间: 2024-10-09 11:52:04