Python: Remove all elements from a given list present in another list using lambda
38. Remove Elements from List Lambda
Write a Python program to remove all elements from a given list present in another list using lambda.
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]
For more Practice: Solve these Related Problems:
- Write a Python program to retain only those elements in a list that are not present in another reference list using lambda.
- Write a Python program to remove duplicates from one list based on the elements in another list using lambda.
- Write a Python program to filter out elements from a list that are multiples of any element in a given reference list using lambda.
- Write a Python program to remove elements from a list if they appear more than once in another list using lambda.
Go to:
Previous: Write a Python program to sort a list of lists by a given index of the inner list using lambda.
Next: Write a Python program to find the elements of a given list of strings that contain specific substring using lambda.
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.