← Back to challenges

Recursion: List Summation

PythonHardrecursionarrays

Instructions

Create a function that sums up all the elements in the list recursively. The use of the sum() built-in function is not allowed, thus, the approach is recursive.

Examples

recur_add([1, 2, 3, 4, 10, 11]) ➞ 31

recur_add([-3, 4, 11, 10, 21, 32, -9]) ➞ 66

recur_add([-21, -7, 19, 3, 4, -8]) ➞ -10

Notes

  • You're expected to solve this challenge using a recursive approach.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.