Consider the two following recursive functions that calculate the factorial of an input that I naively thought would be the same:
fact = lambda x: 1 if x == 0 else x * fact(x-1)fact = lambda x: [x*fact(x-1),1][x==0]
The first runs fine but the second give me the error RuntimeError: maximum recursion depth exceeded. This is true for for inputs where x==0 and x!=0.
Why can't the lambda function handle the second case?