To find transpose of a matrix in python, just choose a matrix which is going to transpose, and choose another matrix having column one greater than the previous matrix and row one less than the matrix. Initially second matrix will be empty matrix. Now find the transpose of matrix and print the transpose result as output.
Following python program shows how to find and print the transpose of a matrix:
# Python Program - Find Transpose of a Matrix matrix = [[1, 2], [3, 4], [5, 6]] rmatrix = [[0, 0, 0], [0, 0, 0]] for i in range(len(matrix)): for j in range(len(matrix)): rmatrix[j][i] = matrix[i][j] for r in rmatrix: print(r)
Here is the sample run of the above python program:
You may also like to learn or practice the same program in other popular programming languages: