Skip to content

Instantly share code, notes, and snippets.

@vlad-bezden
Created May 27, 2016 20:07
Show Gist options
  • Save vlad-bezden/24efc35c2c4ba07c26c1ac3c6a14dbbd to your computer and use it in GitHub Desktop.
Save vlad-bezden/24efc35c2c4ba07c26c1ac3c6a14dbbd to your computer and use it in GitHub Desktop.
Fibonacci number generator in Python
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