How do i prevent users from inserting something other than Yes No | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do i prevent users from inserting something other than Yes No

def ex1(): while 1==1: print("Yes/No please") def yes(): while 1==1: print ("WHY") def no(): print("You have chosen the right path") def check_input(user_input): if user_input.lower() == "Yes": yes() elif user_input.lower() == "No": no() user_input = input("whatever? (Yes/No): ") check_input(user_input) input()

21st May 2020, 11:06 AM
sofronis
sofronis - avatar
1 Answer
0
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 i have the while 1==1 to spam, and yes i have ex1 to tell them to enter yes/no but i dont know how to put it in, i want the programme to close if they enter something that is not yes/no
21st May 2020, 11:59 AM
sofronis
sofronis - avatar