def make_statement(statement , decoration): """emphasises headings by adding decoration""" print(f"{decoration * 3} {statement} {decoration * 3}") def string_check(question, valid_ans_list=('yes', 'no'), num_letter=1): """checks the users enter the full word or the first letter of a word from a list of responces""" while True: response = input(question).lower() for item in valid_ans_list: #checks if the response is the entire word if response == item: return item #checks if the responce is the first letter elif response == item [:num_letter]: return item print(f"please choose an option from {valid_ans_list}") def instructions(): make_statement("instuctions", "***") print("this is how you play (instructions goses here ") def not_blank(question): """checks that the users reponce is not blank""" while True: response = input(question) if response !="": return response print("Sorry, this cant be blank. please try again.\n") def int_check(question, low , high): """checks user enter an integer / foat that is more than zero""" error = f"opps - please enter an interger between {low} and {high}." while True: try: # changing the responce to an integer and check that it is more than 0 response = int (input(question)) if low <= response <= high: return response else: print(error) except ValueError: print (error) #main routine gose here #initalise ticket numbers MAX_TICKETS = 5 tickets_sold = 0 #intialise variables / non-default options for string checker payment_ans = ('cash', 'credit') make_statement("mini_moive fundraiser program", "🍿") print() want_insturctions = string_check("do you want to see the instuctions?") if want_insturctions == "yes": instructions() print() while tickets_sold 120: print(f"{name} is to old. did you make a mistake") continue else: pass payment_method = string_check("paymentmethod:", payment_ans, 2) print(f"{name} has bought a ticket({payment_method})") tickets_sold =+ 1 if tickets_sold == MAX_TICKETS: print(f"you have sold out of tickets (ie: {MAX_TICKETS} tickets") else: print(f"you have sold {tickets_sold}/ {MAX_TICKETS} tickets")