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 float()
Python Program to Convert Decimal to Binary Using Recursion
Python Program to Remove Duplicate Element From a List
Python String rstrip()
Python Tuple
Python Set pop()
Python ascii()
Python String rjust()
Python Program to Print all Prime Numbers in an Interval
Python Dictionary
Python String casefold()
Python Program to Access Index of a List Using for Loop
Python Program to Add Two Numbers
Python int()
Python Variables, Constants and Literals
Python Program to Check Leap Year
Python Program to Print Hello world!
Python Dictionary get()
Python isinstance()
Python List clear()
Python String isdecimal()
Python String encode()
Python Custom Exceptions
Python Program to Sort Words in Alphabetic Order
Python RegEx
Python format()
Python List pop()
Python Program to Find the Square Root
Python Numbers, Type Conversion and Mathematics
Python sorted()
Python abs()
Python String replace()