0 out of 464 challenges solved
Write a Python function `sum_negative_numbers(nums)` that takes a list of integers `nums` as input and returns the sum of all the negative numbers in the list. #### Example Usage ```python [main.nopy] print(sum_negative_numbers([2, 4, -6, -9, 11, -12, 14, -5, 17])) # Output: -32 print(sum_negative_numbers([10, 15, -14, 13, -18, 12, -20])) # Output: -52 print(sum_negative_numbers([19, -65, 57, 39, 152, -639, 121, 44, 90, -190])) # Output: -894 ```
def sum_negative_numbers(nums):
"""
Calculate the sum of all negative numbers in the given list.
Args:
nums (list): A list of integers.
Returns:
int: The sum of all negative numbers in the list.
"""
# Filter the negative numbers from the list
# Calculate the sum of the filtered numbers
pass # Replace this with your implementation