我正在创建一个游戏风格的程序,并正在寻找一个命令,将结束程序在某一点。没有语法错误,并且都在空闲中正确缩进。在
我希望这个命令在if语句的“YOU DIED GAME OVER”后执行。
我试着在网上找任何东西,但找不到任何提示。
以下代码buy2a = input ('Type Y to drink the strange liquid and type N not to')
if buy2a == 'Y' or buy2a == 'y':
chance2a = 2 #random.randint(1,4)
if chance2a == '2' or chance2a == '4' :
print ('You start to choke and you black out')
print ('YOU DIED')
print ('GAME OVER')
# >Thing im looking for goes here!
else :
print ('You feel strange')
time.sleep(1)
print ('You blackout but wake up several hours later')
time.sleep(1)
health = 20
print ('You feel a lot better and now have ' + str(health) + ' health')
else :
print ('You pass on the offer with a weak reason and head off in a hurry')
print ('You enter the next town on weiry feet')