L4 1

def summation(n, term): 
        total, k = 0, 1 
        while k <= n:
            total, k = total + term(k), k + 1 
            return total 
def identity(x): 
    return x
def cube(x):
    return x * x * x
def sum_naturals(n): 
    return summation(n, identity)
def sum_cubes(n): 
    return summation(n, cube)