You are viewing a single comment's thread. Return to all comments →
primary = 0 secondary = 0
for i in range(len(arr)): primary += arr[i][i] # Main diagonal secondary += arr[i][len(arr) - 1 - i] # Secondary diagonal return abs(primary - secondary) for python
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 →
primary = 0 secondary = 0