def string_check_shape(question, valid_ans_list=('circle', 'square', 'triagle','rectangle','xxx'), 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}") #main routine levels = ['easy', 'medium', 'hard'] like_coffe = string_check_shape("do you like coffee", ['yes','no']) print(f"you chose {like_coffe}") chose_level = string_check_shape("chose a level", levels) print(f"you chose {chose_level}")