I need to write a function using recursion that accepts the following variables:
n: int
x: real
and returns the exponential sum function: 
I can't use loops at all, only recursion.
I started by writing two recursive functions for sum and factorial but when I tried to combine the two of them I got the error message:
TypeError: 'int' object is not iterable
I don't quite understand what it means because I didn't use loops, only recursion. Here is my code:
def sum_exp(n):
if n == 0:
return 0
return n + sum(n - 1)
def factorial(n):
if n == 0:
return 1
else:
return n*factorial(n-1)
def exp_n_x(n, x):
if n == 0:
return 1
else:
return sum_exp(x*(1/factorial(n)))
print(exp_n_x(10, 10))
I would love to get some help with this. Thanks a lot in advance.
exp_n_xfunction. Namely, when you divide to integers the result gets truncated... You can fix this by changing(1/factorial(n))to(1.0/factorial(n)).sum_expfunction isn't recursive. It callssum, not itself.sum(0). Same error.