+ 2
Transpose with zip
In this code "zip" is used to transpose "data" from a 4-by-3 matrix to a 3-by-4 matrix I don't know how it works please explain https://code.sololearn.com/c6CLsDss5xqe/?ref=app
8 Réponses
+ 9
The zip() function returns a zip object, which is an iterator of tuples where the first item in each passed iterator is paired together, and then the second item in each passed iterator are paired together etc.
If the passed iterables have different lengths, the iterable with the least items decides the length of the new iterator.
For more info
https://www.geeksforgeeks.org/zip-in-JUMP_LINK__&&__python__&&__JUMP_LINK/amp/
+ 8
In fact, it's very simple, zip(*data) decompresses the tuple data by columns...😎
(0, 1, 2),
(3, 4, 5),
(6, 7, 8),
(9, 10, 11)
+ 6
Write in your python code:
help("zip")
This is very useful to get some information about many topics.
+ 5
You may also want to check the official python docs:
https://docs.python.org/3.3/library/functions.html?highlight=zip#zip
+ 2
Stefanoo thank u
+ 2
JaScript thank u so much⚘
+ 2
Solo thank u
+ 2
Keith thank u