dimanche 6 juin 2021

Why is there an indentation error in a while loop?

I'm making a tic-tac-toe game and I keep having an error in the following part:

while not ganhoux() and not ganhouo() and not completo():
    escolha_jogador()
    if ganhoux() or ganhouo() or completo():
      break
    escolha_computador()

(Basically, the functions ganhoux() and ganhouo() check if there is a line of X and o, respectively. The function completo() checks if the board is complete, to indicate a tie. The functions escolha_jogador() and escolha_computador() control the player's and computer's choices.)

The if statement is there because there might be a situation where the player wins, and in the next round the computer wins. If this were to happen, a problem might occur.

However, in the if line, I get the following error:

IndentationError: unindent does not match any outer indentation level

Do you know what my problem is? If so, please let me know!

Aucun commentaire:

Enregistrer un commentaire