You are viewing a single comment's thread. Return to all comments →
def diagonalDifference(arr): n = len(arr) ld = rd = 0 for i in range(n): ld += arr[i][i] for i in range(n): rd += arr[i][n-1-i] return abs(ld - rd) n = int(input()) arr = [] for a in range(n): arr.append(list(map(int, input().split()))) result = diagonalDifference(arr) print(result)
Seems like cookies are disabled on this browser, please enable them to open this website
Diagonal Difference
You are viewing a single comment's thread. Return to all comments →
For Python3 Platform