Sum of the leaves
Write leaf_sum(root) that returns the sum of the values of all leaves,
the nodes with no children. An empty tree sums to 0.
leaf_sum([8, 3, 10, 1, 6, None, 14]) -> 21 (1 + 6 + 14)
leaf_sum([5]) -> 5
leaf_sum(None) -> 0
The point is to practise a recursion with two base cases: the empty tree and a leaf.
def leaf_sum(root):
...