week0/tictactoe/tictactoe.py
def winner(board):
    """
    Returns the winner of the game, if there is one.
    """
    for player in (X, O):
        # check vertical
        for row in board:
            if row == [player] * 3:
                return player

        # check horizontal
        for i in range(3):
            column = [board[x][i] for x in range(3)]
        if column == [player] * 3:
            return player
        
        # check diagonal
    if [board[i][i] for i in range(0, 3)] == [player] * 3:
        return player

    elif [board[i][~i] for i in range(0, 3)] == [player] * 3:
        return player
    return None

    Returns the winner of the game, if there is one.
    
Returns the winner of the game, if there is one.
Returns the winner of the game if there is one .
def winner(board):
    for player in (X, O):
        for row in board:
            if row == [player] * 3:
                return player
        for i in range(3):
            column = [board[x][i] for x in range(3)]
        if column == [player] * 3:
            return player
    if [board[i][i] for i in range(0, 3)] == [player] * 3:
        return player
    elif [board[i][~i] for i in range(0, 3)] == [player] * 3:
        return player
    return None
def winner ( board ) : for player in ( X , O ) : for row in board : if row == [ player ] * 3 : return player for i in range ( 3 ) : column = [ board [ x ] [ i ] for x in range ( 3 ) ] if column == [ player ] * 3 : return player if [ board [ i ] [ i ] for i in range ( 0 , 3 ) ] == [ player ] * 3 : return player elif [ board [ i ] [ ~ i ] for i in range ( 0 , 3 ) ] == [ player ] * 3 : return player return None
Returns the winner of the game, if there is one.
Returns the winner of the game if there is one .
"""
    Returns the winner of the game, if there is one.
    """ # check vertical # check horizontal # check diagonal
board