zip() function in Python combines multiple iterables (list, dict, etc) and returns a list of tuples where each item of the iterables at the same index are paired together.

Let’s see the syntax for zip() function before dipping into examples.

zip() parameters

Python zip() function parameters
iterablesRequiredOne or more iterables to be paired together

Example 1: Same number of Iterables


Example 2: Different number of Iterables


You can see that zip() scraped the extra roll number from the list and pairs only the available pair values.

Unzip the Value Using zip()

The * operator in python is used to unzip the zipped list. Follow the example below for a clear explanation.


If you have any doubts or suggestions regarding the topic then please comment below.

Leave a Reply

two + 2 =