- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
- Python Advanced Tutorial
- Python - Classes/Objects
- Python - Reg Expressions
- Python - CGI Programming
- Python - Database Access
- Python - Networking
- Python - Sending Email
- Python - Multithreading
- Python - XML Processing
- Python - GUI Programming
- Python - Further Extensions
Python program to print elements which are multiples of elements given in a list
When it is required to print the elements which are multiples of elements given in a list, a list comprehension is used.
Below is a demonstration of the same
my_list = [45, 67, 89, 90, 10, 98, 10, 12, 23] print("The list is :") print(my_list) my_division_list = [6, 4] print("The division list is :") print(my_division_list) my_result = [element for element in my_list if all(element % j == 0 for j in my_division_list)] print("The result is :") print(my_result)
The list is : [45, 67, 89, 90, 10, 98, 10, 12, 23] The division list is : [6, 4] The result is : 
A list is defined and is displayed on the console.
Another list of integers is defined.
A list comprehension is used to iterate over the elements and check if the element divided by element in the integer list gives a remainder 0.
If yes, it is stored in a list and assigned to a variable.
This is displayed as output on the console.
- Related Articles
- Python Program that print elements common at specified index of list elements
- Python program to print all distinct elements of a given integer array.
- Python Program to print elements of a tuple
- C++ program to rearrange all elements of array which are multiples of x in increasing order
- Python Program to Rotate Elements of a List
- Python Program to Replace Elements in a List
- Python - Ways to format elements of given list
- Python program to print the Boundary elements of a Matrix
- Write a program in Python to print the power of all the elements in a given series
- Python program to add elements to a list
- Python Program to replace list elements within a range with a given number
- Program to find number of elements in all permutation which are following given conditions in Python
- Python program to find sum of elements in list
- Python Program to check whether all elements in a string list are numeric
- Python Program To Add Elements To A Linked List