mercredi 1 août 2018

Why this is giving an error[E0001:invalid syntax (

I tried to create an else statement that will check if there is a tie in the TicTacToe board, and it gave me that error:

E0001:invalid syntax (<string>, line 156)

This is the line:

if all(not(i in board):

Now, that is the actual code:

#Checking for a tie:
else:
    #The board's numbers:
    for i in range(1,10):
        #If all or the numbers are not on the board, and no one won or lose...
        if all(not(i in board):
            #...then there's a tie! 
            print("Tie!")
        #If no one loses or won, and there's no tie, then the game isn't over.
        else:
            pass

What is the problem in my code?

Aucun commentaire:

Enregistrer un commentaire