Recursion: List Summation

Published by Deep Xavier in

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.
  • You can read on more topics about recursion (see Resources tab) if you aren't familiar with it yet or haven't fully understood the concept behind it before taking up this challenge.
Watch a quick demo on how Edabit works.