vendredi 8 janvier 2021

If input is equal to string does not work correctly [closed]

When I input '*' it works, but with 'o' it does not. I can't find what I am doing wrong

def trying():    
    player1 = input("Please pick a marker '*' or 'o' ")
    while True:
        if player1.upper() == '*':
            player2='o'
            print("You've choosen " + player1 + ". Player 2 will be " + player2)
            return player1.upper(),player2
        elif player1.upper() == 'o':
            player2='*'
            print("You've choosen " + player1 + ". Player 2 will be " + player2)
            return player1.upper(),player2
        else:
            player1 = input("Please pick a marker '*' or 'o' ")
trying()

Aucun commentaire:

Enregistrer un commentaire