Time to combine functions with a loop. You'll add up the numbers in a list yourself, without using Python's built-in sum().
Your tasks
1. Define a function sum_list(nums) that takes a list of numbers
2. Inside the function, use a for loop to add every number into a running total (start total at 0)
3. Return the total
4. Call sum_list([1, 2, 3, 4]) and print the result
Expected output
10
Constraints
- Build the total with a
for loop and a running variable — do not use the built-in sum() function
- Use
return to send the total back
- No external libraries