The filter() Function for Filtering Collections in Python


Use filter() to select items that meet a condition.

Source Code

even_numbers = list(filter(lambda x: x % 2 == 0, numbers))
print(even_numbers)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments