Last active
November 6, 2018 08:56
-
-
Save kentwait/9b48746bb225f7f43ab3a7d91657e494 to your computer and use it in GitHub Desktop.
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
def fibo_r(x): | |
if x <= 2: | |
return 1 | |
return fibo_r(x-1) + fibo_r(x-2) | |
def fibo_l(x): | |
l = [0, 1, 1] | |
if x <= 2: | |
return 1 | |
for i in range(3, x): | |
l.append(l[-2] + l[-1]) | |
return l[-2] + l[-1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment