def myMap(func, iterable): for item in iterable: yield func(item) result = myMap(str, range(5)) print(result) print(list(result))