I am struggling with this piece of Python code. The problem is,when a user enters something wrong I need my code to keep looping until they input a valid answer. This is how the
As an example, for the drink part to continually loop over until the user enters something valid:
while choice != "1" or choice != "2" or choice != "3" or choice != "4":
choice = input("Please enter a valid drink: ")
if choice == "1" or choice == "fanta":
Order[DRINK] = "Fanta"
if choice == "2" or choice == "coke":
Order[DRINK] = "Coke"
if choice == "3" or choice == "pepsi":
Order[DRINK] = "Pepsi"
if choice == "4" or choice == "sprite":
Order[DRINK] = "Sprite"
I think this would work because it would keep iterating over the loop until the condition is met. And then once the loop is completed, it will execute the code below it.