Get python to end the program in an if statement -


i creating game style program , looking command end program @ point. there no syntax errors , correctly indented in idle.

i want command execute after 'you died game over' bit of if statment. tried online couldn't find hints. code below

buy2a = input ('type y drink strange liquid , 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 choke , black out')       print ('you died')       print ('game over')       # >thing im looking goes here!<# else :     print ('you feel strange')     time.sleep(1)     print ('you blackout wake several hours later')     time.sleep(1)     health = 20     print ('you feel lot better , have ' + str(health) + ' health')  else :     print ('you pass on offer weak reason , head off in hurry') print ('you enter next town on weiry feet') 

use (this standard practice exiting):

import sys  # @ start of file. sys.exit()  # when want exit. 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -