You can try the below code for calculating the diagonal of the elements:
sum(a[i][n-i-1] for i in range(n))
The inner loop will access the below entries:
>>> n = 3
>>> [(i, n-i-1) for i in range(n)]
[(0, 2), (1, 1), (2, 0)]
And the total value of this diagonal for your sample matrix is:
>>> n = 3
>>> sum(a[i][n-i-1] for i in range(n))
19
In your code, the main error was that you have used the same syntax for both dimensions:
a[n-i-1][n-i-1]
which will process the first diagonal again in reverse order [(2, 2), (1, 1), (0, 0)] giving you the same sum twice.
If you are a novice and want to understand more about Python basics then do refer to the Python certification program.