Created
October 21, 2016 09:47
-
-
Save yvan-sraka/3c81b91e909f4d3525222b23a4652415 to your computer and use it in GitHub Desktop.
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
# fibo(0) = 0 | |
# fibo(1) = 1 | |
# fibo(n) = fibo(n-1) + fibo(n-2) | |
# ALGO | |
def fibo(n): | |
a, b = 0, 1 | |
for _ in range(n): | |
a, b = b, a + b | |
return a | |
# TEST | |
for i in range(100): | |
print("fibo(%s) = %s" % (i, fibo(i))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment