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 isalnum()
Python set()
Python List append()
Python getattr()
Python Set clear()
Python Program to Trim Whitespace From a String
Python reversed()
Python Set issubset()
Python Modules
Python Exception Handling Using try, except and finally statement
Python Program to Find the Sum of Natural Numbers
Python Program to Sort a Dictionary by Value
Python hash()
Python String capitalize()
Python ord()
Python String casefold()
How to get current date and time in Python?
Python String rfind()
How to Get Started With Python?
Python String upper()
Python Dictionary copy()
Python List clear()
Python Program to Get the Full Path of the Current Working Directory
Python Program to Check Armstrong Number
Python Set remove()
Python Program to Find Hash of File
Python String count()
Python pow()
Machine Learning with Python for everyone - Mark E.Fenner
Python Program to Find Factorial of Number Using Recursion
Python String encode()
Python slice()