I tried to create an else statement that will check if there is a tie in the TicTacToe board:
#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 gave said that there's a problem with this line:
if all(not(i in board):
This is the error:
E0001:invalid syntax (<string>, line 156)
How to fix the line?
更改if all(not(i in board):
到if all(not(i in board)):
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.