You can download this code by clicking the button below.
This code is now available for download.
This function creates an iterator that aggregates elements from each of the iterables in the given sequence. It converts each iterable into an iterator and then produces tuples from these iterators, continuing until any of the iterators is exhausted.
Technology Stack : Iterator
Code Type : Function
Code Difficulty : Intermediate
def zip(*args):
iters = [iter(arg) for arg in args]
while True:
yield tuple(next(it, None) for it in iters)