Filter

Filter takes a list and applies a function to that list.
filter(function, iterable) Construct a list from those elements of iterable for which function returns true.

>>> list
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
>>> filter(lambda n: n%3 == 0, list)
[0, 6, 12, 18]
>>>

Tags: