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 Inheritance
Python sum()
Python staticmethod()
Python Tuple index()
Python Program to Count the Number of Occurrence of a Character in String
Python Set copy()
Python time Module
Python Namespace and Scope
Python Program to Check Prime Number
Python Program to Get the Class Name of an Instance
Python Deeper Insights into Machine Learning - Sebastian Raschka & David Julian & John Hearty
Python Program to Convert Celsius To Fahrenheit
Python compile()
Machine Learning Applications Using Python - Cases studies form Healthcare, Retail, and Finance - Pu...
Python Dictionary items()
Python Program to Delete an Element From a Dictionary
Python Program to Check Armstrong Number
Python Program to Find the Square Root
How to Get Started With Python?
Python String lstrip()
Python String center()
Node.js vs Python for Backend Development
Python String isspace()
Python Operator Overloading
Building Machine Learning Systems with Python - Willi Richert & Luis Pedro Coelho
Python Dictionary keys()
Python ascii()
Python float()
Python String capitalize()
Python Program to Get the Last Element of the List
How to get current date and time in Python?
Python Deep Learning - Valentino Zocca & Gianmario Spacagna & Daniel Slater & Peter Roelants