|
楼主 |
发表于 2020-4-1 22:24:48
|
显示全部楼层
import random
secret=random.randint(1,10)
print ('------------I love you !-----------')
temp=input ('请录入你猜到的数字:')
while isinstance(temp,int):
temp=input ('请输入整数数字:')
guess=int(temp)
sor=3
if (guess==secret):
print ('我操,居然猜对')
print ('不过猜对也没有奖,哈哈')
else:
if(guess>secret):
print ("哥,大了大了~~!")
while guess!=secret and sor>1:
temp=input ('请重新录入你猜到的数字:')
guess=int(temp)
if (guess==secret):
print ('我操,居然猜对')
print ('不过猜对也没有奖,哈哈')
else:
if(guess>secret):
print ("哥,大了大了~~!")
else:
print("嘿,小了小了~~!!")
sor=sor-1
else:
print("嘿,小了小了~~!!")
while guess!=secret and sor>1:
temp=input ('请重新录入你猜到的数字:')
guess=int(temp)
if (guess==secret):
print ('我操,居然猜对')
print ('不过猜对也没有奖,哈哈')
else:
if(guess>secret):
print ("哥,大了大了~~!")
else:
print("嘿,小了小了~~!!")
sor=sor-1
print('游戏结束!')
|
|