Last active
February 27, 2016 19:10
-
-
Save aromanyuk/d4f7590cbe96472111ec to your computer and use it in GitHub Desktop.
Python fibonacci loop
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 fibonacci(n): | |
foo = bar = 0 | |
for _ in range(n - 1): | |
# print foo, bar | |
if foo == 0: | |
foo = foo + 1 | |
continue | |
foo, bar = [foo + bar, foo] | |
return foo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment