Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

transpose of a matrix in python using loop

X = [[1, 3], [4,5], [7, 9]]

result = [[X[j][i] for j in range (len (X))] for i in range (len (X[0]))]

for r in result:

              print (r)
Comment

PREVIOUS NEXT
Code Example
Python :: range() in python 
Python :: format python decimal 
Python :: python pandas if statement 
Python :: Read multiple csv files into separate dataframes Python 
Python :: how to create a window in pygame 
Python :: join python 
Python :: python label 
Python :: check how many letters in a string python 
Python :: how to get percentage in python 
Python :: what are tuples in python 
Python :: how to import a module from a different directory in python 
Python :: leetcode solutions python 
Python :: how to extract digits from a string in python 
Python :: python range of array 
Python :: get tuple value python 
Python :: py convert binary to int 
Python :: python ascii art 
Python :: DtypeWarning: Columns (7) have mixed types. Specify dtype option on import or set low_memory=False 
Python :: python get all numbers between two numbers 
Python :: python code checker 
Python :: why is python so popular 
Python :: vstack numpy 
Python :: what does tuple mean in python 
Python :: ceil in python3 
Python :: list append python 3 
Python :: python code for twitter scraping using tweepy 
Python :: how split text in python by space or newline with regex 
Python :: python class declaration 
Python :: 2d array python initialize 
Python :: python mad libs 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =