Home >>Python Programs >Python Program to Transpose a Matrix
In this example, we will see a Python program to transpose a given matrix. If you change the rows of a matrix with the column of the same matrix, it is known as transpose of a matrix.
Example :
X = [[3,4],
[6,5],
[7,9]]
result = [[0,0,0],
[0,0,0]]
# iterate through rows
for i in range(len(X)):
for j in range(len(X[0])):
result[j][i] = X[i][j]
for r in result:
print(r)