Created
April 18, 2015 15:50
-
-
Save quantumpotato/49bb52da8eea3ff3e0c6 to your computer and use it in GitHub Desktop.
Input Loop in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stage = 1 | |
def show_prompt(): | |
if stage == 1: | |
print "You are between a volcano and a supernova." | |
print "1 for volcano, 2 for supernova." | |
def restart_input(): | |
print "Nice try." | |
input_loop() | |
def input_loop(): | |
show_prompt() | |
input = raw_input() | |
if input == "1": | |
print "choice 1" | |
elif input == "2": | |
print "choice 2" | |
else: | |
restart_input() | |
return | |
input_loop() | |
input_loop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This could be a little cleaner by removing line 10 and line 21.