Q31Numerical4 Marks11 Dec 2022
What is the output of the following snippet of code? Each entry in the matrix board has one of these two characters: 'X' or 'O'. Your answer should be an integer.
```
def status(M):
n = len(M)
for i in range(n):
index = -1
for j in range(1, n):
if M[i][j] != M[i][j - 1]:
index = -1
break
if M[j][i] != M[j - 1][i]:
index = 2
break
if index >= 0:
break
return index
board = [
['X', 'X', 'O', 'X'],
['O', 'X', 'O', 'O'],
['O', 'O', 'O', 'O'],
['X', 'O', 'O', 'X']
]
print(status(board))
```
Press Enter to check.