Aug-13-2018, 12:06 AM
Hi! I'm trying to make a map with "factorial" func, but with a sum and odd numbers. For example, 1=1, 3=3+1, 5=5+3+1 and so on.
Now I have something like this, but unfortunately it works with errors, but I don't understand why. When I try to pass in function (x-2) instead of (x-1), I get "maximum recursion depth exceeded"
Now I have something like this, but unfortunately it works with errors, but I don't understand why. When I try to pass in function (x-2) instead of (x-1), I get "maximum recursion depth exceeded"
down_sum = lambda x: x and x + down_sum(x - 1) or 0 squares = list(map(down_sum, [1, 3, 5, 7]))