Python built-in functions

Python filter is very useful built-in python function to achieve complex stuff over a list in very short and elegant way. Note that filter applies to any iterable (e.g. list). We’ll use list for the purpose of this tutorial.

Usage: filter(function, iterable)
The function should take one argument and should return boolean value. If true is returned for a value, that value is taken.

Here are some examples.

filter a list by applying a function

Usage: filter(function, iterable)
Given a list of numbers get a new list with items less than 100.