Click here to Skip to main content
13,730,905 members
Rate this:
 
Please Sign up or sign in to vote.
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
Rate this: bad
 
good
Please Sign up or sign in to vote.

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.
  Permalink  
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.180920.1 | Last Updated 26 Nov 2017
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100