M8) Replacing negative values
The four versions of remove_negatives in Listing 1 should:
- Receive a list of integers.
- Return a new list of the same length with each negative value replaced by
0.
The input list must remain unchanged. For example, if numbers is [1, -2, 3, -4, 5], the function should return [1, 0, 3, 0, 5] while numbers remains [1, -2, 3, -4, 5].
Which implementation of the remove_negatives function in Listing 1 correctly returns the required copy without modifying the input list?
remove_negatives function that returns a copy of a list with the negative values replaced by zero (Question 1).