mikeizbicki / cmc-csci040

Computing for the Web
37 stars 58 forks source link

Fibonacci recursion error #248

Closed jacksonaldrich closed 1 year ago

jacksonaldrich commented 2 years ago

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!

mikeizbicki commented 2 years ago

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.

jacksonaldrich commented 2 years ago

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