Python difference between filter and map code example
Example: Python difference between filter and map
nums = [1, 2, 3, 4, 5]
list(map(lambda x: x**2, nums))
#1 4 9 16 25
list(filter(lambda x: x%2==0, nums))
#2 4 6 8
nums = [1, 2, 3, 4, 5]
list(map(lambda x: x**2, nums))
#1 4 9 16 25
list(filter(lambda x: x%2==0, nums))
#2 4 6 8