# Check that users have entered a valid # option based on a list from C_01_yes_no_basic2_v2 import yes_no, want_instructions def string_checker(question, valid_ans): while True: # Gets user response and makes sure it's lowercase user_response = input(question).lower() for item in valid_ans: # Checks to see if the user response is a word in the list if item == user_response: return item # Checks if the user response is the same as the first letter of an item in the list elif user_response == item[0]: return item # Main routine goes here yes_no = ["yes", "no"] rps_list = ["rock", "paper", "scissors", "xxx"] want_instructions = string_checker("Do you want to see the instructions? ", yes_no) print("You chose: ", want_instructions)