why does y = fib(1000) would cause an error on my end?
Thank you for reaching out!
Could you please provide a screenshot of your code and the error you are getting?
Note that solving the Fibonacci numbers problem recursively is very inefficient. An iterative solution would solve the task much faster, especially for larger numbers.
Thank you for your response.
The code looks fine to me. Could you please take a screenshot of the error you get when you run it?
Hey again Leila,
Thank you for the response.
As the error reads, you haven't defined a funtion called
fib but you attempt to use it in line 138. Change that line of code to:
y = fib_2(1000)
and your code should run smoothly.
I already did that, it doesn't cause any errors but it doesn't seem to reflect in the console
I've implemented the code from your screenshot (I've used smaller numbers - 5 and 10) and got the corresponsding output in the console. You can also see the variables
y appear in the Variable Explorer tab (see screnshot attached).
Could you please clarify what you mean by "it doesn't reflect in the console"?
like the solution you gave me doesn't cause any errors, but if I run it, it doesn't seem to reflect in the terminal
If you run the code from my previous response, you should have the result printed out in the terminal. Unfortunately, I'm not sure why the output doesn't appear for you.
Maybe you could share a screenshot of your code and the terminal after you've run the code.