13,730,905 members
See more:
Fairly new at Python. I am trying to find a way to return a transposed copy of a 2 x 2 matrix without using Numpy. I appreciate your patience and willingness to share knowledge. This is how far I have gotten.

What I have tried:

```import math
from math import sqrt
import numbers

def T(self):

m = [[m[j][i] for j in range(len(m))] for in in range(len(m[0]))
print("n\")
for row in rez:
print(row)```
Posted 25-Nov-17 9:42am
Updated 26-Nov-17 2:55am
v2

## Solution 1

What's
`print("n\")`
?
Where did you get the code from? Do you understand it at all?
This
`m = [[m[j][i] for j in range(len(m))] for in in range(len(m[0]))`
is not properly formed. It is supposed to be a nested list comprehension. The correct form should be:
`m = [[m[j][i] for j in range(len(m))] for i in range(len(m[0]))]`
Suggest you visit some tutorial sites on learning Python.
v2

## Solution 2

Top Experts
Last 24hrsThis month
 OriginalGriff 255 Richard MacCutchan 113 Jon McKee 110 CPallini 65 Dave Kreskowiak 60
 OriginalGriff 4,329 Richard MacCutchan 1,414 CPallini 1,064 Patrice T 1,031 Dave Kreskowiak 970