Python Programming - Lambda Functions - Discussion

Discussion Forum : Lambda Functions - General Questions (Q.No. 37)
37.
What is the output of the following code?
numbers = [1, 2, 3, 4, 5]
result = list(filter(lambda x: x % 2 == 0, numbers))
print(result)
[2, 4]
[1, 3, 5]
[1, 2, 3, 4, 5]
[1, 4]
Answer: Option
Explanation:
The filter() function with the lambda filters even numbers from the list.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.