how to order a pizza using python code example
Example: how to order a pizza using python
from pizzapy import Customer, StoreLocator, Order
customer = Customer("Navnath", "Gaikwad", "[email protected]", "5093620471", "150720, E, 4th, Avenue, f101, Homestead, Apt, Spokane, 390037, Washigton, DC")
my_local_dominos = StoreLocator.find_closest_store_to_customer(customer)
print(my_local_dominos)
print("\nMENU\n")
menu = my_local_dominos.get_menu()
menu.search(Name="Coke")
order = Order.begin_customer_order(customer, my_local_dominos, "us")
def searchMenu(menu):
print("You are now seaching the menu...")
item =input("type an item you are looking for:").strip().lower()
if len(item) > 1:
item = item[0].upper() + item[1:]
print(f"Results for: {item}\n")
menu.search(Name=item)
print()
else:
print("no result")
def AddTooOrder(order):
print("please type in the codes of the item you'd like to order...")
print("Press ENTER to stop ordering.")
while True:
item = input("Code:").upper()
try:
order.add_item(item)
except:
if item == "":
break
print("Invaild code")
while True:
searchMenu(menu)
AddTooOrder(order)
answer = input("would you like too add items (y/n)?")
if answer.lower() not in["yes", "y"]:
break
print("Your order is as follows: ")
print(order)