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:
Deep Learning with Applications Using Python - Navin Kumar Manaswi
Python str()
Python Program to Create Pyramid Patterns
Python Tuple
Python Artificial Intelligence Project for Beginners - Joshua Eckroth
Python Data Types
Python open()
Python String replace()
Python Program to Merge Mails
Statistical Methods for Machine Learning - Disconver how to Transform data into Knowledge with Pytho...
Python Program to Count the Number of Digits Present In a Number
Python Operator Overloading
Natural Language Processing with Python - Steven Bird & Ewan Klein & Edward Loper
Python repr()
Python String maketrans()
Node.js vs Python for Backend Development
Python List index()
Python hex()
Python File I/O Operation
Python dict()
Python Program to Convert Two Lists Into a Dictionary
Python exec()
Python Dictionary items()
Python Program to Check If a List is Empty
Python Modules
Python Data Structures and Algorithms - Benjamin Baka
Python bool()
Python String encode()
Python Program to Count the Number of Occurrence of a Character in String
Python bin()
Python Set union()
Python Set isdisjoint()