Essential List Tools Exercise
Question 1 of 4
What's the difference between filter() and map()?
numbers = [1, 2, 3, 4, 5]
result1 = list(filter(lambda x: x > 3, numbers))
result2 = list(map(lambda x: x * 2, numbers))filter() selects elements that meet a condition, map() transforms all elements
map() only works with numbers
filter() transforms elements, map() selects elements
They do exactly the same thing