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 Extract Extension From the File Name
Python Program to Capitalize the First Character of a String
Python getattr()
Python tuple()
Python String title()
Python Program to Get the File Name From the File Path
Python Program to Append to a File
Python String rfind()
Python Program to Find Factorial of Number Using Recursion
Python String upper()
Python Data Types
Java Program to Implement the Program Used in grep/egrep/fgrep
Python Machine Learning Second Edition - Sebastian Raschka & Vahid Mirjalili
Python String expandtabs()
Python List append()
Python String rsplit()
Python File I/O Operation
Python Program to Display the multiplication Table
Python Program to Catch Multiple Exceptions in One Line
Python Program to Solve Quadratic Equation
Python chr()
Python bytearray()
Python String format_map()
Python List remove()
Python print()
Python String partition()
Python Program to Add Two Numbers
Python Anonymous / Lambda Function
Python Program to Find the Factors of a Number
Python Dictionary fromkeys()
Python List index()
Python Custom Exceptions