def string_checker(question, valid_ans=("yes", "no")): while True: user_response = input(question).lower() for item in valid_ans: if item == user_response: return item elif user_response == item[0]: return item def instructions(): """prints instructions""" print(""" *** Instructions *** To begin, choose the number of rounds (or infinite mode). Then answer the questions generated. If you answer correctly, you advance to the next question. If you answer incorrectly, you still advance to the next question, but you get a really bright red cross instead. You will get your final score (if you didn't choose infinite mode) after your rounds have ended. """) #main routine print() print("Multiplication Quiz!") print() #ask the user if they want to see the instructions want_instructions = string_checker("Do you want to see the instructions? ") # Display the instructions if the user responded with yes if want_instructions == 'yes': instructions() print() print("Program continues")