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!')
Этот код выдает следующую ошибку, когда я пытаюсь вызвать его:
if board[1] == mark and board[2] == mark and board[3] == mark
^
SyntaxError: invalid syntax
Эта функция предназначена для проверки на выигрыш в c -ta c -то игра на основе списка python с именем board.
Где моя проблема?
РЕДАКТИРОВАТЬ: При попытке исправить код я получил еще одну ошибку, по-прежнему нужна помощь!
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!')
return True
elif " " not in board:
###############################
#This checks for tie###########
###############################
print('The game ended in a tie!')
return True
Это дает мне следующую ошибку:
def check_over(mark):
^
IndentationError: expected an indented block