pull()
Removes all provided values from the given array.
Implementation
Args: array: List to pull from. values: Values to remove. Returns: Modified `array`. Warning: `array` is modified in place.
Example
pull([1, 2, 2, 3, 3, 4], 2, 3)
Expected output: [1, 4]
Source Code
def pull(array: List[T], *values: T) -> List[T]:
return [x for x in array if x not in values]