Created
March 19, 2010 14:00
-
-
Save lvidarte/337521 to your computer and use it in GitHub Desktop.
fibonacci recursion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> def fibo(a=0, b=1, total=25): | |
... if total == 0: | |
... return | |
... print a | |
... a, b = b, a + b | |
... fibo(a, b, total-1) | |
... | |
>>> fibo() | |
0 | |
1 | |
1 | |
2 | |
3 | |
5 | |
8 | |
13 | |
21 | |
34 | |
55 | |
89 | |
144 | |
233 | |
377 | |
610 | |
987 | |
1597 | |
2584 | |
4181 | |
6765 | |
10946 | |
17711 | |
28657 | |
46368 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment