Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:

Python
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
Updated 26-Nov-17 2:55am
v2

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.
 
Share this answer
 
v2
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900