def average(a): if len(a) == 1: return a[0] else: n = len(a) return (a[0] + (n - 1) * average(a[1:])) / n print(average([1,2,3]))