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 Convert String to Datetime
Python String startswith()
How to Get Started With Python?
Python Set difference()
Python String rpartition()
Python String swapcase()
Python hasattr()
Python Program to Merge Mails
Python Program to Check If a List is Empty
Python String isnumeric()
Python String translate()
Python open()
Python Modules
Python Program to Append to a File
Deep Learning with Python - A Hands-on Introduction - Nikhil Ketkar
Python Inheritance
Python Program to Create Pyramid Patterns
Python Object Oriented Programming
Python Program to Convert Decimal to Binary Using Recursion
Python Dictionary fromkeys()
Python String isupper()
Python Functions
Python Program to Iterate Over Dictionaries Using for Loop
Python Program to Convert Bytes to a String
Python Program to Find ASCII Value of Character
Python Machine Learning Cookbook - Practical solutions from preprocessing to Deep Learning - Chris A...
Python strftime()
Python Program to Print all Prime Numbers in an Interval
Python str()
Python String isalnum()
Python all()
Python print()