Solve this recursion problem in python.
Problem: Given an array of integers, find the sum of its elements.

For example, if the array ar = [1, 2, 3], then 1 + 2 + 3 = 6.
def sum(arr):
    if not arr:
        return 0
    else:
        return arr[0] + sum(arr[1:])