samedi 13 novembre 2021

Why is this if statement being triggered when the list does not contain the conditions the if statement specifies?

Why is the first if statement being triggered and not the elif statement after it?

player_moves = [1, 3, 4]
computer_moves = [5, 2]
if 4 and 5 in computer_moves and 6 not in player_moves:
    computer_moves.append(6)
    print("Computer chooses " + str(computer_moves[-1]))
elif 2 and 5 in computer_moves and 8 not in player_moves:
    computer_moves.append(8)
    print("Computer chooses " + str(computer_moves[-1]))

Aucun commentaire:

Enregistrer un commentaire