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 Program to Transpose a Matrix
Python Variables, Constants and Literals
Python Program to Find Factorial of Number Using Recursion
Python Dictionary fromkeys()
Python String isprintable()
Python String ljust()
Python time Module
Python globals()
Python dir()
Python Program to Differentiate Between type() and isinstance()
Python String rpartition()
Python String islower()
Python String rindex()
Python Set update()
Python List append()
Python String isnumeric()
Python Program to Split a List Into Evenly Sized Chunks
Python Program to Reverse a Number
Python String casefold()
Python Set issubset()
Python Program to Find Sum of Natural Numbers Using Recursion
Python String isspace()
Python list()
Python Program to Safely Create a Nested Directory
Python tuple()
Python Set add()
Python Iterators
Python Program to Display Calendar
Python sorted()
Deep Learning from Scratch - Building with Python form First Principles - Seth Weidman
Python Program to Find the Factorial of a Number
Python Program to Check if a Number is Odd or Even