Filter demo: lambda function inside : filter « Buildin Function « Python






Filter demo: lambda function inside

Filter demo: lambda function inside


foo = [2, 18, 9, 22, 17, 24, 8, 12, 27]
 
print filter(lambda x: x % 3 == 0, foo)

           
       








Related examples in the same category

1.Compute prime numbers in PythonCompute prime numbers in Python
2.Functional Programming Tools: filterFunctional Programming Tools: filter
3.filer with lambda function and rangefiler with lambda function and range