How to remove multiple items from a list in Python

Removing multiple elements from a list results in a new list excluding those elements. For example, removing the elements in [1, 3] from the list [1, 2, 3, 4] results in [2, 4].

Solution for How to remove multiple items from a list in Python : You can use a for-loop to remove multiple items from a list Use a for-loop to iterate through the original list. Use if element not in list to check if element is not in the list of elements to remove list. If it is not, use list.append(object) to add object to an initially empty list.

Use a list comprehension for a more compact solution.

original_list = [1, 2, 3, 4]


how-to-remove-multiple-items-from-a-list-in-python