# 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).lower() if user_response in valid_ans: return user_response print(error) # 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.. ''') # 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") def string_checker(question, valid_ans): while True: user_response = input(question).strip().lower() if user_response in valid_ans: return user_response else: print("Please answer yes or no.") # List of valid answers yes_no_list = ["yes", "no"] # 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_list) if want_instructions == "yes": print("\nYou will see a menu with options for pizza sauces, toppings, and gourmet toppings" "Select toppings by entering the corresponding number. Type done when you've finished selecting toppings..\n") elif want_instructions == "no" or want_instructions == "No": print("no instructions ") else: print("please answer yes or no") # 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" ) 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") # Refactored 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 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") # 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}")