Prerequisite : Lambda in Python
Given a list of numbers, find all numbers divisible by 13.
Input : my_list = [12, 65, 54, 39, 102, 339, 221, 50, 70] Output : [65, 39, 221]
We can use Lambda function inside the filter() built-in function to find all the numbers divisible by 13 in the list. In Python, anonymous function means that a function is without a name.
The filter() function in Python takes in a function and a list as arguments. This offers an elegant way to filter out all the elements of a sequence “sequence”, for which the function returns True.
[65, 39, 221]
Given a list of strings, find all palindromes.
['geeg', 'keek', 'aa']
Given a list of strings and a string str, print all anagrams of str
- Python lambda (Anonymous Functions) | filter, map, reduce
- Intersection of two arrays in Python ( Lambda expression and filter function )
- Python | sympy.Lambda() method
- Overuse of lambda expressions in Python
- Python | Find fibonacci series upto n using lambda
- Map function and Lambda expression in Python to replace characters
- Lambda expression in Python to rearrange positive and negative numbers
- Ways to sort list of dictionaries by values in Python - Using lambda function
- filter() in python
- Python | Pandas dataframe.filter()
- Python | Pandas Series.filter()
- Python | Filter even values from a list
- Python | Filter the negative values from given dictionary
- Python PIL | Image filter with ImageFilter module
- Python | Filter out integers from float numpy array
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.