Home >>Python Built-in Functions >Python zip() Function
Python zip() function is used to return a zip object that is the iterator of the tuples where the primary item present in each passed iterator is paired together then the second item present in each passed iterator are paired together etc.
Syntax:zip(iterator1, iterator2, iterator3 ...)
Parameter | Description |
---|---|
iterator1, iterator2, iterator3 ... | This parameter defines the Iterator objects that will be joined together. |
a = ("Kia", "Nisha", "Jenny")
b = ("Jerry", "Rohit", "Mike")
x = zip(a, b)
print(tuple(x))
a = ("John", "Koko", "Mike")
b = ("Jenny", "Christy", "Tutu", "Vicky")
x = zip(a, b)
print(tuple(x))