I hope to accept user's input as yes/no, if user input yes, the code will continue run the avaliable code, it user input no, the code will notifying user again and code will not run until user input 'yes' finally
Here is the brief introdcution:
# Here is part1 of code
a = input('Have you finished operation?(Y/N)')
if a.lower() == {'yes','y' }
# user input 'y', run part2 code
if a.lower() == {'no', 'n'}
# user input no
# code should notifying user again "'Have you finished operation?(Y/N)'"
# part2 code will run until user finally input 'y'
if a.lower() !={'yes','y', 'no', 'n'}:
# user input other words
# code should notifying user again "'Have you finished operation?(Y/N)'"
# here is part2 of code
Do you have any ideas on how to solve this problem, I would appreciate if you can provide some suggestions
Update
here is the code I'm tring
yes = {'yes','y',}
no = {'no','n'}
print(1)
print(2)
while True:
a = input('Have you create ''manually_selected_stopwords.txt'' ???(Y/N)''')
if a.lower().split() == yes:
break
if a.lower().split() == no:
continue
print(3)
print(4)
When I run it, it shows as follows, the first time I tried input 'n' and then 'y', this will always notifying me, even I type into 'y' and will not print 3 and 4
1
2
Have you create manually_selected_stopwords.txt ???(Y/N)>? n
Have you create manually_selected_stopwords.txt ???(Y/N)>? y
Have you create manually_selected_stopwords.txt ???(Y/N)>? y
Have you create manually_selected_stopwords.txt ???(Y/N)>? y
Have you create manually_selected_stopwords.txt ???(Y/N)