# Functions go here import pandas def string_check(question, valid_list=('yes', 'no'), num_letters=1): """Checks that users enter the full word or the first 'n' letters from a list""" while True: response = input(question).strip().lower() for item in valid_list: item_low = item.lower() if response == item_low: return item elif response == item_low[:num_letters]: return item print(f"Please choose an option from {valid_list}") def instructions(): print("Pizza Paladin Instructions," "ℹ️") print(""" The program will record the users data that they entered, then proceed to the main menu of what Pizza Paladin offers. Once you have ordered your pizza (up to 5 maximum allowed), or entered the exit code (‘xxx’), the program will display the receipt information regarding the customers order and information, writing the data to a text file. The program proceeds by asking would you like to pick-up or deliver the pizza to your address. You enter 'Pick-up' or 'Deliver' For each customer should enter ... ------ (IF PICK-UP WAS CHOSEN) ------ - Their name - Their age - Phone number - The payment method (cash / credit) ------ (IF DELIVERY WAS CHOSEN) ------ - Their name - Their age - Phone number - Address - The payment method (cash / credit) The program will record the users data that they entered, then proceed to the order by printing a receipt """) def make_statement(statement, decoration, lines=1): middle = f"{decoration * 3} {statement} {decoration * 3}" top_bottom = decoration * len(middle) if lines == 1: print(middle) elif lines == 2: print(middle) print(top_bottom) else: print(top_bottom) print(middle) print(top_bottom) def not_blank(question): """Checks that a user response is not blank""" while True: response = input(question) if response != "": return response print("Sorry, this can't be blank. Please try again.\n") def int_check(question): """Checks users enter an integer that is more than zero (or the 'xxx' exit code)""" error = "Oops - please enter an integer." while True: response = input(question).lower() if response == "xxx": return response try: response = int(response) if response > 0: return response else: print(error) except ValueError: print(error) def currency(x): """Formats numbers as currency ($#.##)""" return "${:.2f}".format(x) # Options for obtaining the pizza they ordered print() pizza_delivered_pickup = ["Deliver", "Pick Up"] deliver_options = "You can either: Deliver or Pick Up" print(deliver_options) print() get_pizza = string_check("Choose how you would like to get the pizza, refer to the above: ", pizza_delivered_pickup, 5) print() print(f"You chose to {get_pizza} the pizza") print() if get_pizza == "Deliver": address = not_blank("Please enter your address: ") print() print(f"Your pizza will be delivered to {address} in 15 minutes! ") elif get_pizza == "Pick Up": print(f"Your Pizza will be ready to pick up in 15 minutes!") print()