• + 0 comments

    As array indices also start from zero, it would be convenient to let range function start from 0 (which it does by default):

    print(max([sum(arr[i][j:j+3] + [arr[i+1][j+1]] + arr[i+2][j:j+3]) for i in range(4) for j in range(4)]))