Last active
March 21, 2016 15:44
-
-
Save f3rdy/80e9efd5c19df5a13cb9 to your computer and use it in GitHub Desktop.
A simple test to provide code for a gist
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 fib(maximum): | |
""" | |
Calculate the fibonacci numbers below maximum | |
:param maximum: the maximum number | |
:return: a list containing fibonacci numbers | |
""" | |
a, b = 1, 1 | |
result = [a, b] | |
while True: | |
a, b = b, b+a | |
if b < maximum: | |
result.append(b) | |
else: | |
return result | |
def main(): | |
for i in fib(5000): | |
print i | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment