[Solved] When we get a RecursionError in Python, statistically speaking, is it always a mistake to choose recursion?
I have a code that I think I have numerous problems with. The code has a recursive function. And apparently my iterable in the function argument which depends on input might exceed recursion depth. Upon search, I see that the recursion depth can be set to other values. But: If I have such an error, does this indicate that: I should have chosen some other approach than recursion knowing that the problem doesn't impose a limit on the number to be inputted? Or is it the case that I should have used some sort of generator instead of an iterable that's not lazy.(if that’s possible, sounds weird to me) I am not looking for solutions. No solutions. I am looking to gain familiarity for future self troubleshooting. Here's the example code: https://code.sololearn.com/cTmGCFktNghO/?ref=app (Edit: a last min change I'd made to the code made it output the same thing at all conditions. Sorry for that, got rid of it, thanks noteve) Thanks to all in advance.