On Fri, Feb 7, 2014 at 9:05 PM, rakesh sharma
<rakeshsharm...@hotmail.com> wrote:
> Hi
>
> Shouldn't your code be like this
>
> def fib(n):
> if n==0:
> return 0
> else:
> return n + fib(n-1)
>
> this works
>
>>>> for i in range(4):
> print fib(i)
>
> 0
> 1
> 3
> 6
>>>>

interesting, but the Fibonacci sequence is 1,1,2,3,5,8,13,...

-Denis H.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to