transpose a matrix using list comprehension code example
Example: transpose a matrix using list comprehension
MT = [[0,0,0], [0,0,0], [0,0,0]]
for ir in range(3):
for ic in range(3):
MT[ic][ir] = M[ir][ic]
MT = [[0,0,0], [0,0,0], [0,0,0]]
for ir in range(3):
for ic in range(3):
MT[ic][ir] = M[ir][ic]