cmc-csci040 icon indicating copy to clipboard operation
cmc-csci040 copied to clipboard

Fibonacci recursion error

Open jacksonaldrich opened this issue 3 years ago • 2 comments

Hello @mikeizbicki,

I keep getting only 1 failed test for the fibonacci code. It passes each one besides the "fibonacci(1000)", and displays the following error:

RecursionError: maximum recursion depth exceeded in comparison

Should I set a higher recursion depth, or re-write the code to not have this issue?

Thanks!

jacksonaldrich avatar Sep 19 '22 06:09 jacksonaldrich

Recursion is not something that we've covered in class, and not something that you need to use on this problem. (And actually, if you do use it, your code will likely take millions of years to compute fibonacci(1000).) Instead, use a for loop following the pseudocode in the docstring.

mikeizbicki avatar Sep 19 '22 06:09 mikeizbicki

Thank you! I will take a look and make the adjustments

jacksonaldrich avatar Sep 19 '22 07:09 jacksonaldrich