harbor run -t openthoughts/tasktrove-exp-rpt-taco-v2-taco-2486
harbor download openthoughts/tasktrove-exp-rpt-taco-v2-taco-2486
You are given an array of numbers. Your task is to return the sum of all the positive numbers in the array.
0
Input: [1, -4, 7, 12] Output: 20 Explanation: The sum of positive numbers is 1 + 7 + 12 = 20.
[1, -4, 7, 12]
20
1 + 7 + 12 = 20
Input: [-1, -2, -3] Output: 0 Explanation: There are no positive numbers to sum.
[-1, -2, -3]
Input: [0, 5, 8, -2, 3] Output: 16 Explanation: The sum of positive numbers is 5 + 8 + 3 = 16.
[0, 5, 8, -2, 3]
16
5 + 8 + 3 = 16
Please implement the solution in the /app/ directory.
/app/
def sum_of_positives(numbers: List[int]) -> int: pass
Make sure your solution handles all edge cases appropriately, including arrays with only negative numbers and empty arrays.
Important: place your implementation at /app/solution.py so the verifier can run it.
/app/solution.py