>>> revdiag = [M[i][i] for i in [2, 1, 0]]
>>> revdiag
[9, 5, 1]

The reverse diag entries (that you are seeking to get) are not correct.
They should be M[0][2], M[1][1], M[2][0].
So the code could be --

revdiag = []
for i in [0, 1, 2]:
    j = 2 - i
    revdiag.append( M[i][j] )

I hope it helps.

--
Ashfaq
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to