Lists · warm-up
Total of a list
Write total(nums) returning the sum of a list of numbers, with a loop — sum() is off limits here. The total of an empty list is 0.
- right answers
- arguments left as they should be
- without sum
Run adds print(total([1, 2, 3])) after your code, to try it.
Stuck on the idea rather than the code? The Lists lesson walks through it.