|

楼主 |
发表于 2020-8-12 23:26:21
|
显示全部楼层
print("""----------------用python设计的第一个第一个游戏---------------""")
print('猜一猜我心里想的是哪个数字:',end='')
import random
life=3
answer=random.randint(1,10)
while life>0:
temp = input()
temp = int(temp)
life=life-1
if temp == answer:
print('''猜对了,你是爷心里的蛔虫吗?
哼,猜中了也莫得奖励!''')
break
else:
if temp<answer:
print('太小啦!!!')
else:
print('太大啦!!!')
if life>0:
print('还有',life,'''次机会哦!
再试一次吧:''',end='')
else:
print('机会用完啦!!')
print("--------------------游戏结束-----------------")
这是我自己的代码- -但是拥上去没有什么不同呀 |
|