You are viewing a single comment's thread. Return to all comments →
Did the same thing essentially. Just shortened it.
arr = [[int(x) for x in input().split()] for _ in range(6)]
hoursum = lambda arr,r,c: sum(arr[r-1][c-1:c+2]) + arr[r][c] + sum(arr[r+1][c-1:c+2])
ans = max(hoursum(arr,r,c) for r in range(1,5) for c in range(1,5))