Reputation: 341
I have a the following code:
def fib(n):
if n < 1: return 1
return fib(n-1) + fib(n-2)
Where I would put in an array from 1-10000 as n and it would give me an error. May someone help me point out the problem?
Upvotes: 0
Views: 4297
Reputation: 1979
The point of the problem is that you can't pass a list to your function. Your function wants an integer value.
>>> fib(5)
13
As expected. So you should pass just a number (n) to your function to calculate fibonacci of it.
Upvotes: 2