Created
May 27, 2016 20:07
-
-
Save vlad-bezden/24efc35c2c4ba07c26c1ac3c6a14dbbd to your computer and use it in GitHub Desktop.
Fibonacci number generator in Python
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(i): | |
"""Return all fibonacci numbers up to N. """ | |
a, b = 0, 1 | |
while a <= i: | |
yield a | |
a, b = b, a + b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment