# Functions go here def make_statement(statement, decoration): """Emphasis headings by adding decoration at the start and end""" print(f"{decoration * 3} {statement} {decoration * 3}") def string_check(question, valid_answer=('yes', 'no'), num_letters=1): """Checks that users enter the full word or the 'n' letter/s of a word from a list of valid responses""" while True: response = input(question).lower() for item in valid_answer: # check if the response is the entire word if response == item: return item # check if it's the first letter elif response == item[:num_letters]: return item print(f"Please choose an option from {valid_answer}") # Main routine goes here # payment_list = ['cash', 'credit'] while True: want_instruction = string_check("Do you want instructions? ") print(f"you chose {want_instruction}") print() def instructions(): make_statement("Instructions", "❕") print(''' This program will ask you for ... - The name of the product you are selling - How many items you are planning on selling - The costs for each component of the product (variable expenses) - Whether or not you have fixed expenses (if you have fixed expenses, it will ask you what they are) - How much money you want to make (ie: your profit goal) It will also ask you how much the recommended sales price should be rounded to. The program outputs an itemised list of the variable and fixed expenses (which includes the subtotals for these expenses). Finally it will tell you how much you should sell each item for to reach your profit goal. The data will also be written to a text file which has the same name as your product and today's date. ''') make_statement("Fundraising Calculator", "💲") print() want_instructions = string_check("Do you want to see the instructions? ") if want_instructions == "yes": instructions() print() print("Program continues...") def not_blank(question): """Checks that a user response is not blank""" while True: response = input(question) if response != "": return response print("Sorry, this cant be blank. Please try again.\n")