Python: Remove all elements from a given list present in another list
Remove Elements Present in Another List
Write a Python program to remove all elements from a given list that are present in another list.
Sample Solution:
Python Code:
Sample Output:
Original lists: list1: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] list2: [2, 4, 6, 8] Remove all elements from 'list1' present in 'list2: [1, 3, 5, 7, 9, 10]
Flowchart:

For more Practice: Solve these Related Problems:
- Write a Python program to remove multiple elements from a list by value.
- Write a Python program to filter a list by excluding elements from another list.
- Write a Python program to find common and uncommon elements in two lists.
- Write a Python program to create a difference list from two lists.
Go to:
Previous: Write a Python program to sort a list of lists by a given index of the inner list.
Next: Write a Python program to find the difference between elements (n+1th – nth) of a given list of numeric values.
Python Code Editor:
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.