from functools import partial

def sum_powers(x, terms):
    result = 0
for term in terms:
    result += term ** x
return result
sum_squares = partial(sum_powers, x=2)
sum_squares(terms=[1, 2, 3])
sum_cubes = partial(sum_powers, x=3)
sum_cubes(terms=[1, 2, 3])
Create math function with a 'dummy' variable to be evaluated later