为什么这会在python 3

时间:2018-08-01 17:35:41

标签: python if-statement syntax-error

我试图创建一个else语句,以检查TicTacToe板上是否有领带:

#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

Python表示此行存在问题:

if all(not(i in board):

这是错误:

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

如何修线?

1 个答案:

答案 0 :(得分:3)

if all(not(i in board):更改为if all(not(i in board)):