Matrix Transpose in Python || 2D Array || Python

In this we are going to see a basic program to calculate Transpose of a Matrix in 2D Array in Python Programming Language.


X = [[1,7],
    [4 ,9],
    [7 ,8]]

result = [[0,0,0],
         [0,0,0]]


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)


#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post