Python Program to Find Transpose of Matrix

« Previous Program Next Program »

Find Transpose of Matrix in Python

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.

Python Programming Code to Find Transpose of Matrix

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[0])):
		rmatrix[j][i] = matrix[i][j]

for r in rmatrix:

Here is the sample run of the above python program:

python find transpose of matrix

Same Program in Other Languages

You may also like to learn or practice the same program in other popular programming languages:

« Previous Program Next Program »


Quick Links
Signup - Login - Give Online Test