Skip to content

Instantly share code, notes, and snippets.

@quantumpotato
Created April 18, 2015 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quantumpotato/49bb52da8eea3ff3e0c6 to your computer and use it in GitHub Desktop.
Save quantumpotato/49bb52da8eea3ff3e0c6 to your computer and use it in GitHub Desktop.
Input Loop in Python
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()
@quantumpotato
Copy link
Author

This could be a little cleaner by removing line 10 and line 21.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment