Created
August 28, 2011 08:34
-
-
Save vasily-kirichenko/1176428 to your computer and use it in GitHub Desktop.
Python fibonacci
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 fib(n): | |
| if n == 0 or n == 1: | |
| return n | |
| else: | |
| return fib(n-1) + fib(n-2) | |
| for i in range(40): | |
| print ("n=%d => %d" % (i, fib(i))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment