Dec-12-2017, 10:51 PM
Looking at this code:
Do not understand how it transposes rows into columns. For a start, does row[1] means [1] or [1,2,3,4]?
If it means 1 then does in each iteration row from "for row" refers to the row below the previous one?
Quote:matrix = [
[1,2,3,4],
[5,6,7,8],
[9,10,11,12],
]
r = [[row[i] for row in matrix] for i in range(4)]
print®
Do not understand how it transposes rows into columns. For a start, does row[1] means [1] or [1,2,3,4]?
If it means 1 then does in each iteration row from "for row" refers to the row below the previous one?