Home > Net >  I want to make my program tell the user that there input is invalid for a multiple choice question
I want to make my program tell the user that there input is invalid for a multiple choice question

Time:05-26

I have a multiple choice question but I want the code to tell the user that there input is wrong if they have inputted an invalid answer:

https://i.stack.imgur.com/fCtz8.png

Ive used a != statement which has only worked for single answer questions:

if drinkselect != "cola":

print("Not on our menu!\n")

Any help would be appreciated!

CodePudding user response:

while True:

  delivery=input("input......")
  if delivery == "yes":
     print("yes....")
     
  elif delivery == "no":
     print("no...")
     
  else:
      print("invalid input....")

CodePudding user response:

while True: deliveryselect=input('Do you want delivery? \n Yes: Delivery\n No: No delivery \n \n') if deliveryselect=='Yes'or deliveryselect=='yes': print('Thank You') break elif deliveryselect =='No' or deliveryselect=='no': print('Thank you') break else: print('Invalid Choice') break

  • Related