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 List clear()
Python print()
Python del Statement
Python Dictionary fromkeys()
Deep Learning in Python - LazyProgrammer
Python Program to Check the File Size
Python Program to Create a Countdown Timer
Python Machine Learning Third Edition - Sebastian Raschka & Vahid Mirjalili
Python List reverse()
Python if...else Statement
Python Program to Generate a Random Number
Python Set discard()
Python Program to Count the Number of Digits Present In a Number
Python String rstrip()
Python Program to Slice Lists
Python Program to Capitalize the First Character of a String
Python Program to Get Line Count of a File
Node.js vs Python for Backend Development
Python List
Python super()
Python int()
Python reversed()
Machine Learning Applications Using Python - Cases studies form Healthcare, Retail, and Finance - Pu...
Python eval()
Python Object Oriented Programming
Python Program to Print Hello world!
Python pass statement
Python String istitle()
Python String format()
Python tuple()
Python String rindex()
Python Program to Check if a Number is Odd or Even