Skip to content

Instantly share code, notes, and snippets.

@volgoweb
Forked from garrettdreyfus/yesOrNo.py
Created May 12, 2017 10:01
Show Gist options
  • Save volgoweb/7808cac577b7b8d695adea0f617affe5 to your computer and use it in GitHub Desktop.
Save volgoweb/7808cac577b7b8d695adea0f617affe5 to your computer and use it in GitHub Desktop.
Dead simple python function for getting a yes or no answer.
def yes_or_no(question):
reply = str(raw_input(question+' (y/n): ')).lower().strip()
if reply[0] == 'y':
return True
if reply[0] == 'n':
return False
else:
return yes_or_no("Uhhhh... please enter ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment