Working on some homework, and for the past few hours I havent figured out how to fix this issue, ive tried doing many different things to it and doing much research, even tried an online IDE and it had the exact same issue… The return True; wont return, ive tried printing out right before the return and it prints fine. Thank you for reading.
#imports
import math
#functions
times_looped=0
def menus(menu_type):
times_looped=0
if(menu_type==0):
print("Main Menu:")
elif(menu_type==1):
print("Drinks:")
elif(menu_type==2):
print("Fries:")
#----------
for i in menu[menu_type][0]:
indention=""
for j in range(20-len(i)):
indention=indention+" ";#sets correct ammount of spaces to keep the prices looking linear.
print(i+indention+str(menu[menu_type][2][times_looped]))#uses previous information given to make the next line on the menu.
times_looped+=1
times_looped=0
if(menu_type==0):
print("We also sell drinks and fries!")
else:
print("We also have a main menu!")
def nofc(food, food_type):#number_of_food_count() was a bit lengthy, so I shortened it.
print("How much " + food.lower() + " would you like?")
nput = input(">>>")
if(nput.isdigit() and int(nput)>0):
for i in range(int(nput)):
menu[food_type][1].append(food.lower().capitalize())
print("Successfully added " + nput +" "+ food +("s" if int(nput)>1 else "")+ " to your order.")
elif(nput.count(".")==1 and ((str(i) in nput) for i in range(9))):
if(float(nput)>0):
print("I am going to pretend I didnt hear that.")#cuz le chickens are living
else:
print("Please only input whole numbers.")
else:
print("Please only input whole numbers.")
def order():
nput = input(">>>").upper()#var name = funny way to spell input
if("CHIC" in nput):
nofc("Chicken", 0)
elif("BEEF" in nput or "COW" in nput):
nofc("Beef", 0)
elif("VEG" in nput or "PLANT" in nput):
nofc("Vegetarian", 0)
elif("PORK" in nput or "PIG" in nput):
nofc("Pork", 0)
else:
if("DRI" in nput):
menus(1)
nput = input(">>>").upper()
for i in menu[1][1]:
if (i.upper()==nput):
nofc(nput.lower().capitalize(), 1)
break
elif("FRI" in nput or "FRY" in nput):
if(nput=="FRY"):
print("you want just one fry? how weird... oh well... guess you can have one... I will give it to you for free just to make it easier on me...")
print("")
print("\033[32mYou receive exactly one fry\033[0m")
else:
menus(2)
nput = input(">>>").upper()
for i in menu[2][1]:
if (i.upper()==nput):
nofc(nput.lower().capitalize(), 2)
break
elif(not "MAI" in nput):
print("That is not an option, please try something else.")
if("MAI" in nput):
return True
#variables
global cheat_code
cheat_code="xyzzy"#might make a reference easter egg to the first text based video game.
global part
part=0#method for location
global x
x=False
#I know we are not alloud to do lists, but I got tired and I dont mind loosing a few points for that.
menu=[[],[],[]]
menu[0]=[#main
["Chicken","Beef","Vegetarian","Pork"],#-----#names
[], #inventory-------------------------------#inventory
[25.99, 50.99, 666.66, 70.19] #prices--------#prices
]
menu[1]=[#drinks
["Small", "Medium", "Large", "Extra Large"], #names
[], #inventory-------------------------------#inventory
[20.00, 40.00, 80.00, 160.00] #prices--------#prices
]
menu[2]=[#fries
["Small", "Medium", "Large", "Extra Large"], #names
[], #inventory-------------------------------#inventory
[160.00, 80.00, 40.00, 20.00] #prices--------#prices
]
print("welcome too hell, what would you like to order?")
print("we also sell expensive pills")
print("")
menus(0)
order()
print("Is that all?")
part=0
while True:
nput = input(">>>").upper()#var name = funny way to spell input
if(part==0 or part==0.1):
if(("Y" in nput and not "NO" in nput) or "YES" in nput):
part=1
elif("N" in nput):
menus(0)
if(order()==True):
print("")
else:
print("Is that all?")
else:
print("I am sorry, but I do not know the British language, I will just assume that is a yes.")
part=1
if(part==1):
print("part==1")
print(menu)