Mar-02-2019, 10:00 PM
(This post was last modified: Mar-02-2019, 10:07 PM by TreasureDragon.)
(Mar-02-2019, 06:55 PM)ichabod801 Wrote: Well, looking at your code, you are actually working in 2D. Your matrices are stored as a list of lists. So you can just use the code I showed you. Note that it will give you a generator, not a list, but you can fix that by doingtransposed = list(zip(*matrix))
The reason it works is that zip takes any number of lists as parameters. It then returns a list of the first item in each list, a list of the second item in each list, a list of the third item in each list, and so on. The star (*) notation converts a sequence (like a list) into a series of parameters.
Oh. So just simply use the code? But it's a library function isn't it... We aren't allowed to use those for now :(
And the code didn't work...