2019-12-22 14:40:23 +01:00
|
|
|
import sys
|
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
|