resetting and "if" statement

I am having trouble resetting and if statement to capture the correct input into the command:

If you select '2', if it will ask you again. If you respond 'L', it will capture that as a valid command, however the 'Letter' variable will still be stored as the original input '2'. How do I reset the first command to take the second?

# Letters is captured in a list A-Z

def choose_letter(question):
        Letter = input('choose a letter:')
        if Letter not in Letters:
          print('Please choose a valid Letter. A-Z.')
          choose_letter(question)
        else:
          return Letter


Read more here: https://stackoverflow.com/questions/64950726/resetting-and-if-statement

Content Attribution

This content was originally published by Alex at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: