So I'm currently scripting an ordering system as a Python project. My plan is to allow customers to switch between menus and order items from those menus when they are prompted to. Here's the code I'm working on so far:
def order():
global input1
global itemCode
menu = open("FoodMenu.txt","r")
while(input1 != "X"):
for line in menu:
data = line.split(";")
itemCode = data[0]
itemName = data[1]
itemPrice = float(data[2])
if itemCode == input1:
print(itemCode + " - " + itemName + " - $" + str(itemPrice))
input1 = input("Enter an Item Code or [X] to exit.")
#Start
print("******************* TAKEAWAY ORDERING SYSTEM ******************")
print(" ")
print(" [O] Order ")
print(" [X] Exit ")
print(" ")
print("***************************************************************")
input1 = input("Select an option to begin: ")
while input1 != "O" or input1 != "X":
if input1 == "O" or input1 == "X":
break
input1 = input("Please select from one of the options above: ")
if input1 == "O":
print("A;Crispy Chicken;5.25")
print("B;Boneless Box;5.49")
print("C;Hot Wings;2.19")
print("D;Chicken Nuggets;3.59")
print("E;Smoky-Grilled Chicken;6.30")
order()
When the system asks "Enter an Item Code or [X] to exit.", and after I provide the input, I expect it to print the Item Name as well as the price:
print(itemCode + " - " + itemName + " - $" + str(itemPrice))
But instead, it only asks the question again, nothing else. What am I missing here?