You are viewing a single comment's thread. Return to all comments →
def diagonalDifference(arr): lr = rl = 0 n = len(arr) for i in range(n): lr += arr[i][i] rl += arr[i][n-1-i] return abs(lr - rl) n = int(input()) arr = [] for _ 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
I wrote the code from scratch just to get more practice