zip()
takes two or more lists and combines them for you.
Similar to map
and filter
, you need to use it inside list function if you want to display meaningful values. Otherwise it will just print the memory address of the function object.
zip()
will return tuples in a list, something that looks like:
[(1,2),(3,4),(4,5)]
After that it’s very east to address the items. First item comes from the first list that’s being merged and second item in the tuple comes from the second list.
Let’s see some examples: