lundi 24 décembre 2018

Syntax for testing multiple conditions in a single if statement in python 3.6 using spyder IDE

I am trying to design a Tic Tac Toe game and designed a function that tests for the winning condition.The complier is throwing the error invalid syntax at the closing bracket of if statement.Can someone please help as I am still a newbie.

def win_check(board, marker,position):
    board[position] = marker
    if((board[9]=='X' and board[6] =='X' and board[3] == 'X') or
       (board[8]=='X' and board[5] =='X' and board[2] == 'X') or
       (board[7]=='X' and board[4] =='X' and board[1] == 'X') or
       (board[7]=='X' and board[8] =='X' and board[9] == 'X') or
       (board[4]=='X' and board[5] =='X' and board[6] == 'X') or
       (board[1]=='X' and board[2] =='X' and board[3] == 'X') or
       (board[1]=='X' and board[5] =='X' and board[9] == 'X') or
       (board[7]=='X' and board[5] =='X' and board[1] == 'X') or
       ):
        print("Player choosen X is winner")
        break()

multiple conditions in single if statement

Aucun commentaire:

Enregistrer un commentaire