0 out of 464 challenges solved
Write a Python function `remove_elements(list1, list2)` that takes two lists as input and returns a new list containing all elements from `list1` that are not present in `list2`. #### Example Usage ```python [main.nopy] remove_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2, 4, 6, 8]) # Output: [1, 3, 5, 7, 9, 10] remove_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 3, 5, 7]) # Output: [2, 4, 6, 8, 9, 10] remove_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [5, 7]) # Output: [1, 2, 3, 4, 6, 8, 9, 10] ```
def remove_elements(list1, list2): """ Removes all elements from list1 that are present in list2. Args: list1 (list): The list to filter. list2 (list): The list containing elements to remove from list1. Returns: list: A new list with elements from list1 not in list2. """ # Write your code here pass