input: Write a function to calculate the sum of elements in an array using recursion.
  assert sum([1, 2, 3, 4, 5]) == 15
  assert sum([10, 20, 30, 40, 50]) == 150
  assert sum([-1, -2, -3, -4, -5]) == -15
output: def sum(array):
      if not array:
          return 0
      return array[0] + sum(array[1:])