# Check that the users have entered a valid # option based on a list def string_checker(question, valid_ans1): error = f"Please enter a valid option from the folowing list: {vaild_ans1}" while True: # Get user response and make sure it's lowercase user_response = input(question).lower() for item in valid_ans1: # check if the user response is a # word in the list if item == user_response: return item # check if the user response is the same as # the first letter of an itm in the list elif user_response == item[0]: return item else: print(error) # Main routine goes here rps_list = ["rock", "paper", "scissors"] yes_no =["yes", "no"] user_choice = string_checker("choose p , s, r: ",rps_list) print(f"You chose: {user_choice}")