I have to calculate a equation that have a recursion. But if I am execute the code i get the failure that the Float object is not iterable
my code is:
def v(t, c):
result = []
if t == 0 or c == 0:
return 0
q = v(t - 1, c) - v(t - 1, c - 1)
return max((0.2*(400-q)), (0.6*(400-q)), (1*(1200-q)), (0.85*(1115-q)), (0.87*(1127-q))) + v(t-1,c)
x = v(2, 1) print(x)
What can I do to get the result? Thank you
maxtakes an iterable, you pass it afloat. The error message is quite to the point. What do you want the maximum of there when you pass a single value to the function?