Python Programming - Functions - Discussion

Discussion Forum : Functions - General Questions (Q.No. 78)
78.
How can you use the filter function to filter out even numbers from a list?
filter(lambda x: x % 2 != 0, my_list)
filter(lambda x: x % 2 == 0, my_list)
filter(is_even, my_list)
filter(is_odd, my_list)
Answer: Option
Explanation:
The correct usage of the filter function to filter out even numbers is filter(lambda x: x % 2 != 0, my_list).
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.