Created
July 22, 2015 17:51
-
-
Save saleph/232bf1a3cd3df3a392db to your computer and use it in GitHub Desktop.
recursive fib sequence
This file contains 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
__author__ = "tom" | |
def fib(n): | |
if n == 1: | |
return 1 | |
if n == 2: | |
return 1 | |
return fib(n-1) + fib(n-2) | |
print([fib(x) for x in range(1, 30)]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment