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 String replace()
Python Artificial Intelligence Project for Beginners - Joshua Eckroth
Deep Learning with Python - Francois Chollet
Python Set issubset()
Python all()
Python Dictionary copy()
Python frozenset()
Python Program to Append to a File
Intelligent Projects Using Python - Santanu Pattanayak
Python Program to Iterate Through Two Lists in Parallel
Python Program to Find All File with .txt Extension Present Inside a Directory
Python Input, Output and Import
Python Program to Check if a Key is Already Present in a Dictionary
Python String find()
Python list()
Python __import__()
Python Set copy()
Python Matrices and NumPy Arrays
Python Program to Catch Multiple Exceptions in One Line
Python pass statement
Statistical Methods for Machine Learning - Disconver how to Transform data into Knowledge with Pytho...
Python Program to Count the Number of Digits Present In a Number
Python List clear()
Python String join()
Python Program to Add Two Numbers
Python Program to Convert Decimal to Binary, Octal and Hexadecimal
Python String rindex()
Python Program to Convert String to Datetime
Deep Learning with Python - Francois Cholletf
Python enumerate()
Python String format()
Python Program to Make a Flattened List from Nested List