2019-12-22 14:40:23 +01:00

18 lines
341 B
Python

import sys
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