import random
while 1:
print('----------------------------------------')
temp=input('不妨猜一下我心里想的数字:')
guess=int(temp)
digit=random.randint(0,100)
count=0
while 1:
count=count+1
if(guess>digit):
print('猜错了,我很小')
guess=int(input('不妨再猜一下我心里想的数字:'))
elif(guess<digit):
print('猜错了,我很大')
guess = int(input('不妨再猜一下我心里想的数字:'))
else:
print('恭喜你猜对了')
print('你共用了{0}次'. format(count))
break
python--while猜数字
最新推荐文章于 2023-01-15 04:31:03 发布