fibonacci series what Iam is missing ?

Ganesh Pal ganesh1pal at gmail.com
Mon Mar 23 12:01:49 EDT 2015


Hello team ,


[root at localhost Python]# cat  fibonacci-Sequence-3.py

## Example 2: Using recursion
def fib(n):
    if n == 0:
        return 0
    elif n == 1:
        return 1
    else:
        return fib(n-1) + fib(n-2)
print fib(5)

# python  fibonacci-Sequence-3.py
5

what Iam I missing in the program , I was expecting 0,1,1,2,3 ?



More information about the Python-list mailing list