Junior — Middle+
Generator that simulates the work of the map function
livecode
Task condition
Implement a generator that reproduces the behavior of the built-in map function, applying the given function to each element of the specified iterable object.
Example 1: Input: res = my_map(lambda x: x * 2, [1, 2, 3]) Output: [2, 4, 6]