Skip to content

Instantly share code, notes, and snippets.

@andriiburka
Created May 31, 2020 17:47
Show Gist options
  • Save andriiburka/cf4d8a1e80f0ce64ef938895157f3b34 to your computer and use it in GitHub Desktop.
Save andriiburka/cf4d8a1e80f0ce64ef938895157f3b34 to your computer and use it in GitHub Desktop.
matrix = [list(map(int, input().split())) for _ in range(int(input()))]
diagonal1 = [(matrix[i][i]) for i in range(len(matrix))]
diagonal2 = [matrix[i[0]][i[1]] for i in tuple(
zip([h for h in range(len(matrix))], [v for v in range(len(matrix) - 1, -1, -1)]))]
print(abs(sum(diagonal1) - sum(diagonal2)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment