You are getting this error because you are accessing the nested lists the wrong way, do it like this:
B[k][j] = A[i][j]
Not like this: B[k, j] = A[i, j]
Also your code seems to be unnecessarily complicated you can just do it like this:
A = A[::-1]
This would get you the required result.