闲来无聊的游戏
#coding:utf-8
import random
num = random.randint(1,100)
while True:
num_input = input('请输入一个数:')
if not num_input.isdigit():
print('请输入数字')
elif int(num_input) < 0 or int(num_input)>100:
print('请输入0到100之间的数')
else:
if int(num_input) == num:
print('恭喜你,猜对了!')
break
elif int(num_input) < num:
print('小了!')
else:
print('大了!')
print('游戏结束!')