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 Function Arguments
Python Program to Randomly Select an Element From the List
Python Program to Check Prime Number
Python Dictionary setdefault()
Python input()
Python reversed()
Python Program to Find ASCII Value of Character
Python Program to Check the File Size
Python Program to Iterate Through Two Lists in Parallel
Statistical Methods for Machine Learning - Disconver how to Transform data into Knowledge with Pytho...
Python Program to Differentiate Between type() and isinstance()
Python hash()
Python open()
Python List remove()
Python Program to Count the Number of Occurrence of a Character in String
Python isinstance()
Python Program to Make a Flattened List from Nested List
Python float()
Python list()
Python String islower()
Python List count()
Python id()
Python Program to Multiply Two Matrices
Python Set union()
Python Program to Display the multiplication Table
Python Dictionary get()
Python Program to Copy a File
Building Machine Learning Systems with Python - Willi Richert & Luis Pedro Coelho
Python Modules
Python Program to Display Fibonacci Sequence Using Recursion
Python Multiple Inheritance
Python Program to Find the Square Root