标签:put 程序 pre 猜数游戏 lse python程序 while NPU guess
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(‘-----游戏结束-----‘)
标签:put 程序 pre 猜数游戏 lse python程序 while NPU guess
原文地址:https://www.cnblogs.com/cylf/p/10567285.html