What's wrong with this if elif else code in python?
Question: I'm making a simple Rock, Paper, Scissor game. As you can see in the code
snippet, the program asks the user if they want to play best out of 3 or 5.

If the input is `'five', '5'` or `'cinco'` the function `best_out_of_five()`
executes (which prints `'5555555'` to console for now). Similarly, an input of
`'three', '3',` or `'tres'` prints `'3333333'`

My problem is that whatever input is read, it just executes the
`best_out_of_five()` function (even if the input is 'three'). I thought the
if, elif and else would be the easiest part of my code since I have done it
many times before, but I must be missing something that I just can't notice.

    
    
    import time
    
        def best_out_of_three():
            print('333333333')
    
        def best_out_of_five():
            print('555555555')
    
        name = input("Hi, what's your name?\n")
        print('Alright %s, lets play a quick game of Rock, Paper,'
              'Scissors. Do you want to play best out of 3 or 5?' % name)
        game_type = input().lower()
        if game_type in ['five', '5', 'cinco']:
            best_out_of_five()
        elif game_type in ['three', '3', 'tres']:
            best_out_of_three()
        else:
            print("That is not a valid answer. Try again later.")
            time.sleep(5)
            exit()
    


Answer: Included this in edit, but your if check should check all options. One way to
do that quickly is to use a list:

    
    
    if game_type in ['five', '5', 'cinco']:
            best_out_of_five()
        elif game_type in ['three', '3', 'tres']:
            best_out_of_three()
    

If your input is in the list (a linear check against all values in the list),
then it will return true.

