Created
February 9, 2017 08:10
-
-
Save math2001/4846ab8c233b402d0613057fbe85d13d to your computer and use it in GitHub Desktop.
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
def confirm(question): | |
YES, NO = ['yes', 'y'], ['no', 'n'] | |
ans = '' | |
while ans not in YES + NO: | |
ans = input(question + ' (y/n) ').strip().lower() | |
if ans in YES: | |
return True | |
elif ans in NO: | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment