Complete the code to check if a player has won by filling the blank.
if board[row][col] == [1]: return True
The win condition checks if the current cell matches the player's symbol.
Complete the code to count consecutive symbols in a row.
count = 0 for c in range(len(board[0])): if board[row][c] == [1]: count += 1
We count cells matching the player's symbol to check for a win in the row.
Fix the error in the diagonal win check by filling the blank.
for i in range(size): if board[i][i] != [1]: return False return True
The diagonal must have all cells matching the player's symbol to win.
Fill both blanks to check vertical win condition correctly.
for r in range(size): if board[r][col] != [1]: return False return [2]
Check each cell in the column for the player's symbol; if all match, return True.
Fill all three blanks to complete the function that checks horizontal, vertical, and diagonal wins.
def check_win(board, player): size = len(board) for i in range(size): if all(board[i][j] == [1] for j in range(size)): return [2] if all(board[j][i] == [1] for j in range(size)): return [2] if all(board[i][i] == [1] for i in range(size)): return [2] if all(board[i][size - 1 - i] == [1] for i in range(size)): return [2] return [3]
The function checks all win conditions for the player symbol and returns True if any are met, otherwise False.
