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 staticmethod()
Natural Language Processing with Python - Steven Bird & Ewan Klein & Edward Loper
Python Program to Print Colored Text to the Terminal
Python Artificial Intelligence Project for Beginners - Joshua Eckroth
Java Program to Implement the Program Used in grep/egrep/fgrep
Python min()
Python Dictionary clear()
Building Machine Learning Systems with Python - Willi Richert & Luis Pedro Coelho
Python Program to Generate a Random Number
Python Set issubset()
Python break and continue
Machine Learning with Python for everyone - Mark E.Fenner
Python Program to Find the Sum of Natural Numbers
Deep Learning with Python - A Hands-on Introduction - Nikhil Ketkar
Python locals()
Python String swapcase()
Python List append()
Python Program to Calculate the Area of a Triangle
Python hash()
Python String translate()
Python List reverse()
Python Program to Sort Words in Alphabetic Order
Python Program to Print the Fibonacci sequence
Python Dictionary setdefault()
Python Multiple Inheritance
Python Program to Convert Decimal to Binary Using Recursion
Python sleep()
Python property()
Python Program to Merge Two Dictionaries
Python Program to Reverse a Number
Python Program to Count the Number of Digits Present In a Number
Python Program to Get the File Name From the File Path