Fibonacci series recursion error

lalit opposite800 at gmail.com
Sat Apr 30 05:22:48 CEST 2011


import os
def fib(n):
	if n == 1:
          return(n)
	else:
          return (fib(n-1)+fib(n-2))

list=fib(20)
print(list)

The above function return the
return (fib(n-1)+fib(n-2))


RuntimeError: maximum recursion depth exceeded in comparison
[36355 refs]

can any one help



More information about the Python-list mailing list