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 Split a List Into Evenly Sized Chunks
Python Set copy()
Python String upper()
Python zip()
Python filter()
Python Decorators
Python String partition()
Python eval()
Python Program to Find ASCII Value of Character
Python round()
Python Package
Python List copy()
Python Objects and Classes
Python Set difference()
Python help()
Python String startswith()
Python ord()
Python type()
Python List count()
Python String format()
Python Functions
Python Program to Check if a Number is Odd or Even
Python String istitle()
Python Program to Slice Lists
Python Dictionary keys()
Python Dictionary items()
Python Program to Differentiate Between del, remove, and pop on a List
Python Program to Find Armstrong Number in an Interval
Python 3 for Absolute Beginners - Tim Hall & J.P Stacey
Statistical Methods for Machine Learning - Disconver how to Transform data into Knowledge with Pytho...
Python List
Python tuple()