赞
踩
方法一
while True:
first = int(input('请输入一个数'))
while True:
second = int(input('请猜'))
if second > first:
print('比答案大了')
elif second == first:
print('正确')
break
else:
print('比答案小了')

由系统随机出一个数字猜
import random
while True:
first = random.randrange(100) #一百之内随机一个数字
while True:
second = int(input('请猜:'))
if first>second:
print('小了')
elif first==second:
print('对了')
break
else:
print('大了')

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。