# Function to check input def string_checker(question, valid_ans): while True: error = f"Enter a valid response from {valid_ans}" user_response = input(question).strip().lower() if user_response in valid_ans: return user_response print(error) def string_checker1(question, valid_ans): while True: error = f"enter a valid option from {valid_ans}" user_response = input(question).lower() for item in valid_ans: # check if user response is a valid answer if item == user_response: return item elif user_response == item[0]: return item print(error) print() # Function to display history def history(): print(''' In the heart of New Zealand's bustling food scene, nestled among the vibrant streets of Mount Maunganui, lies Whanau Pizzeria—a cornerstone of culinary delight since its inception in the early 1990s. Founded by Italian immigrants Luca and Sofia Di Napoli, who brought with them generations-old recipes and a passion for authentic Italian cuisine, Whanau Pizzeria quickly became a beloved local institution. ''') # Function for choosing payment method def cash_credit(question): while True: response = input(question).lower() if response == "cash" or response == "ca": return "cash" elif response == "credit" or response == 'cr': return "credit" else: print("Please choose a valid payment method.") # varibles size_option = ["large", "medium", "small"] # Display welcome and history print("<--- Welcome to the Whanau Pizzeria --->") print("In this order system, you will create a custom pizza. Note: All pizza bases are plain.") want_history = string_checker("\nWould you like to learn about the history of Whanau Pizzeria: ", ["yes", "no"]) if want_history == "yes": history() # Delivery or Pick-up want_order = string_checker("Would you like to order delivery or pick up: ", ["delivery", "pick up"]) if want_order == "delivery": print("\nThe delivery cost will be calculated at the end of the order!") elif want_order == "pick up": print("Our address is:") print("565 Maunganui Road, Mount Maunganui 3116.") print("See you soon!\n") # Ask user if they want to see the instructions want_instructions = string_checker("Do you want to read the instructions? (yes or no): ", ["yes", "no"]) if want_instructions == "yes": print("\nYou will see a menu with options for pizza sauces, toppings, and gourmet toppings." "\nSelect toppings by entering the corresponding number. Type 'done' when you've finished selecting toppings.\n") elif want_instructions == "no": print("No instructions will be displayed.\n") else: print("Please answer yes or no.\n") # Menu Display print("<--------------- Menu --------------->") print( "Pizza Sauces:" "\n1- Cheese sauce: $1.50" "\n2- Pesto sauce: $1.50" "\n3- Marinara: Free" "\n4- Barbeque: $1.50\n" "\nToppings:" "\n5- Mozzarella Cheese: $1.50" "\n6- Ground beef: $3.50" "\n7- Smoked ham: $3.50" "\n8- Pepperoni: $3.50" "\n9- Onion: $2.00" "\n10- Olives: $2.00" "\n11- Spinach: $2.00" "\n12- Spring Onion: $1.00\n" "\nGourmet toppings:" "\n13- Premium Italian Sausage: $5.50" "\n14- Smoked Bacon: $3.50" "\n15- Slow cooked lamb: $5.50" "\n16- Camembert cheese: $3.50" "\n17- Capsicum: $4.50\n" '''\n Small | Medium | Large | $5 | $7 | $9 | ------|--------|-------| ''') print( "Note: Marinara sauce is free. Other sauces are $1.50 extra. The pizza will automatically have Marinara sauce unless another sauce is added.\n") #toppings menu as dictionary toppings_menu = { "1": {"name": "Cheese sauce", "cost": 1.50}, "2": {"name": "Pesto sauce", "cost": 1.50}, "3": {"name": "Marinara", "cost": 0.0}, "4": {"name": "Barbeque", "cost": 1.50}, "5": {"name": "Mozzarella Cheese", "cost": 1.50}, "6": {"name": "Ground beef", "cost": 3.50}, "7": {"name": "Smoked ham", "cost": 3.50}, "8": {"name": "Pepperoni", "cost": 3.50}, "9": {"name": "Onion", "cost": 2.00}, "10": {"name": "Olives", "cost": 2.00}, "11": {"name": "Spinach", "cost": 2.00}, "12": {"name": "Spring Onion", "cost": 1.00}, "13": {"name": "Premium Italian Sausage", "cost": 5.50}, "14": {"name": "Smoked Bacon", "cost": 3.50}, "15": {"name": "Slow cooked lamb", "cost": 5.50}, "16": {"name": "Camembert cheese", "cost": 3.50}, "17": {"name": "Capsicum", "cost": 4.50} } # Toppings selection chosen_toppings = [] total_cost = 0.0 # size of pizza size = string_checker("What Size | Small $5 | Medium $7 | Large $9 |: ", size_option) while True: topping_choice = input( "Enter the number of the topping you would like to add (or enter 'done' if finished): ").strip().lower() if topping_choice == "done": break elif topping_choice in toppings_menu: topping_name = toppings_menu[topping_choice]["name"] cost = toppings_menu[topping_choice]["cost"] total_cost += cost chosen_toppings.append(topping_name) print(f"{topping_name} added. Current total: ${total_cost:.2f}") else: print("Sorry, please enter a number from the menu.") # Display chosen toppings and total cost if chosen_toppings: print("\nChosen toppings:") for topping in chosen_toppings: print(f"- {topping}") print(f"\nTotal cost for toppings: ${total_cost:.2f}\n") else: print("\nNo toppings selected.\n") # Payment method selection payment_method = cash_credit("Choose a payment method (cash or credit): ") print(f"You have chosen to pay with {payment_method}.") # Review section print("\n--------- Review of Whanau Pizzeria ---------\n") # Ask for rating print("Please rate your overall experience at Whanau Pizzeria (1-5) stars") rating = input("Enter your rating: ") # Validate rating while not rating.isdigit() or int(rating) < 1 or int(rating) > 5: print("Invalid rating. Please enter a number between 1 and 5 stars.") rating = input("Enter your rating: ") # Convert rating to integer rating = int(rating) # Ask for comments print("\nWould you like to leave any comments about your experience?") comments = input("Enter your comments (or press Enter to skip): ") # Display review summary print("\nThank you for your review!") print(f"You rated Whanau Pizzeria {rating}/5 stars. 🍕🎉") if comments: print(f"Comments: {comments}")