To share this page click on the buttons below;
zip
zip(iterable1 , iterable2 , ...)
returns an iterator.
That iterates over t-uple that are made by elements taken by each of the iterable passed as arguments.
So the first t-uple will be composed by the first element of iterable1, the first element of iterable2 and so on; the second t-uple will be composed by the second element of iterable1, the second element of iterable2 and so on.
Since zip returns an iterator to obtain a list or a dictionary from zip it is necessary to use list(zip(...))
or dict(zip(...))
.
To share this page click on the buttons below;