Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #87832
| Date | 2015-03-23 21:31 +0530 |
|---|---|
| Subject | fibonacci series what Iam is missing ? |
| From | Ganesh Pal <ganesh1pal@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.70.1427126512.10327.python-list@python.org> (permalink) |
Hello team ,
[root@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 ?
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
fibonacci series what Iam is missing ? Ganesh Pal <ganesh1pal@gmail.com> - 2015-03-23 21:31 +0530
Re: fibonacci series what Iam is missing ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-24 11:11 +1100
Re: fibonacci series what Iam is missing ? Ganesh Pal <ganesh1pal@gmail.com> - 2015-03-24 18:31 +0530
csiph-web