Skip to content

Instantly share code, notes, and snippets.

@lvidarte
Created March 19, 2010 14:00
Show Gist options
  • Save lvidarte/337521 to your computer and use it in GitHub Desktop.
Save lvidarte/337521 to your computer and use it in GitHub Desktop.
fibonacci recursion
>>> 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