Write a python function to emulate the behavior of built-in map() function


Topic: Write a python function to emulate the behavior of built-in map() function

Solution

def pad_none(iterable):
    """Returns the sequence elements and then returns None indefinitely.
    Useful for emulating the behavior of the built-in map() function.
    """
    from itertools import chain, repeat
    return chain(iterable, repeat(None))



List all Python Programs