def check_over(mark):
######################################
#This checks for a win################
######################################
if board[1] == mark and board[2] == mark and board[3] == mark
or board[4] == mark and board[5] == mark and board[6] == mark
or board[7] == mark and board[8] == mark and board[9] == mark
or board[1] == mark and board[4] == mark and board[7] == mark
or board[2] == mark and board[5] == mark and board[8] == mark
or board[3] == mark and board[6] == mark and board[9] == mark
or board[1] == mark and board[5] == mark and board[9] == mark
or board[3] == mark and board[5] == mark and board[7] == mark:
print(f'{mark} won!')
This code yields the following error when I try to call it:
if board[1] == mark and board[2] == mark and board[3] == mark
^
SyntaxError: invalid syntax
This function is meant to check for a win in a tic-tac-toe game based on a python list named board.
Where is the problem?
You can not have have new lines in the middle of your line in python. Try the following: