+ 7
For Python 2 map and filter returned a list object. In Python 3, map returns an iterable generator type, map object, and filter returns a filter object. It isn't always necessary. it depends on how you wish to use it. The code below will print each mapped int without the need to convert to a list first. nums = [11, 22, 33, 44, 55] result = map(lambda x: x+5, nums) for i in result: print(i) outputs: 16 27 38 49 60
9th Jun 2020, 5:10 PM
ChaoticDawg
ChaoticDawg - avatar