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 for Loop
Python Program to Check if a Number is Odd or Even
Python next()
Python String encode()
Python String casefold()
Python String rindex()
Python input()
Python divmod()
Python Program to Split a List Into Evenly Sized Chunks
How to get current date and time in Python?
Python Program to Reverse a Number
Python len()
Python Program to Shuffle Deck of Cards
Python object()
Python List sort()
Python Sets
Python Machine Learning Second Edition - Sebastian Raschka & Vahid Mirjalili
Python for Programmers with introductory AI case studies - Paul Deitel & Harvey Deitel
Python Dictionary values()
Python property()
Python callable()
Python Program to Sort Words in Alphabetic Order
Python Set symmetric_difference_update()
Python Deeper Insights into Machine Learning - Sebastian Raschka & David Julian & John Hearty
Python Functions
Deep Learning with Applications Using Python - Navin Kumar Manaswi
Python reversed()
Python Data Analytics with Pandas, NumPy and Matplotlib - Fabio Nelli
Python String center()
Python Numbers, Type Conversion and Mathematics
Python List count()
Python Set intersection()