You can download this code by clicking the button below.
This code is now available for download.
The function returns a list of tuples, where each tuple contains the i-th element from each of the argument sequences or iterables. The returned list is a flattened list of tuples, so if the iterables have different lengths, the shorter iterable is truncated.
Technology Stack : Built-in Python library
Code Type : Built-in functions
Code Difficulty :
def zip(*iterables):
"""
Returns a list of tuples, where the i-th tuple contains the i-th element from each of the argument sequences or iterables.
The returned list is a flattened list of tuples, so if the iterables have different lengths, the shorter iterable is truncated.
"""
zipped = []
for iterable in iterables:
for item in iterable:
zipped.append(item)
return zipped