I tried the most basic approach for matrix transpose in python. However, I don't get the required results. Following by the code:
A = [ [1, 1, 1, 1],
[2, 2, 2, 2],
[3, 3, 3, 3],
[4, 4, 4, 4]]
#print (A)
def TS (A):
B = A
for i in (range(len(A))):
for j in (range(len(A))):
A[i][j] = B [j][i]
TS(A)
#print (A)
for i in range(len(A)):
for j in range(len(A)):
print(B[i][j], " ", end='')
print()
This is the result I get:
1 2 3 4
2 2 3 4
3 3 3 4
4 4 4 4