In this program, you’ll learn to find the numbers divisible by another number and display it.
To understand this example, you should have the knowledge of the following Python programming topics:
In the program below, we have used anonymous (lambda) function inside the filter() built-in function to find all the numbers divisible by 13 in the list.
Source Code
# Take a list of numbers
my_list = [12, 65, 54, 39, 102, 339, 221,]
# use anonymous function to filter
result = list(filter(lambda x: (x % 13 == 0), my_list))
# display the result
print("Numbers divisible by 13 are",result)
Output
Numbers divisible by 13 are [65, 39, 221]
Related posts:
Python Program to Find Factorial of Number Using Recursion
Python Dictionary fromkeys()
Python range()
Python Set difference()
Python List count()
Python chr()
Python frozenset()
Python String isalnum()
Python Program to Get a Substring of a String
Python Program to Check Prime Number
Python exec()
Python tuple()
Natural Language Processing with Python - Steven Bird & Ewan Klein & Edward Loper
Python Program to Safely Create a Nested Directory
Statistical Methods for Machine Learning - Disconver how to Transform data into Knowledge with Pytho...
Python compile()
Python Artificial Intelligence Project for Beginners - Joshua Eckroth
Python Machine Learning - Sebastian Raschka
Python Global, Local and Nonlocal variables
Python Program to Check If a List is Empty
Python String istitle()
Python Program to Shuffle Deck of Cards
Python String lower()
Python Program to Compute the Power of a Number
Python String rpartition()
Python Tuple index()
Python Multiple Inheritance
Python Program to Print Colored Text to the Terminal
Python Dictionary get()
Python String translate()
Python Program to Transpose a Matrix
Python Program to Find ASCII Value of Character