zip()
function is used to find the take iterables (can be zero or more), makes iterator that aggregates elements based on the iterables passed, and returns an iterator of tuples in Python for the given input.
zip()
function is a part of Python Built-in Functions.
Syntax of zip()
Function
The syntax of
zip()
function in Python is:
zip(*iterables)
Parameters of zip()
Function in Python
x
– Where x
is any valid . This parameter is required.
Compatibility
zip()
function is available and compatible with both Python 2.x
and 3.x
.
Return Value of zip()
Function in Python
zip()
function returns take iterables (can be zero or more), makes iterator that aggregates elements based on the iterables passed, and returns an iterator of tuples for the given input.
Python zip()
Function Example 1
Example CODE
Output:
Python zip()
Function Example 2
Example CODE
Output: