#!/usr/bin/env python
from typing import List

def get_matrix_row_from_input() -> List[int]:
    return [int(index) for index in input().strip().split(' ')]


n = int(input().strip())
primary_diag_sum = 0
secondary_diag_sum = 0
for row_count in range(n):
    row = get_matrix_row_from_input()
    primary_diag_sum += row[row_count]
    secondary_diag_sum += row[-1 - row_count]

print(abs(primary_diag_sum - secondary_diag_sum))

Add Diagonal Difference HackerRank Problem
Add Diagonal Difference HackerRank Problem

* https://www.hackerrank.com/challenges/diagonal-difference
