To find the maximal value in a matrix of numbers, we can code 5 lines to solve the problem:
ans = matrix[0][0] for x in range(len(matrix)): for y in rang
You can also flatten your array:
from itertools import chain flatten = chain.from_iterable max(flatten(matrix))