Creating an Iterator with Zip Functionality

  • Share this:

Code introduction


Create an iterator that returns a tuple of elements, where each tuple contains the i-th element from each of the argument iterables.


Technology Stack : Built-in library

Code Type : Built-in functions

Code Difficulty :


                
                    
def zip(*iterables):
    """Create a zip object from one or more iterables.

    Args:
        *iterables: An arbitrary number of iterables.

    Returns:
        An iterator of tuples, where the i-th tuple contains the i-th element from each of the argument iterables.
    """
    # Code here
    return zip(*iterables)

# JSON description