17 lines
330 B
Python
Raw Normal View History

2019-07-11 13:21:42 +02:00
def y_n_question(question_str):
yes = {'yes','y', 'ye', ''}
no = {'no','n'}
while True:
sys.stdout.write(question_str + " [Y/n]: ")
choice = input().lower()
if choice in yes:
return True
elif choice in no:
return False
else:
sys.stdout.write("\nPlease respond with 'yes' or 'no'\n")
continue