Skip to content

Instantly share code, notes, and snippets.

@lachlan-eagling
Created October 5, 2019 01:47
Show Gist options
  • Save lachlan-eagling/cef44ad27b9fc91da4b4464d6b4125fa to your computer and use it in GitHub Desktop.
Save lachlan-eagling/cef44ad27b9fc91da4b4464d6b4125fa to your computer and use it in GitHub Desktop.
Blog - Generators (Fibonacci)
def fib_generator(n):
i, j = 0, 1
for _ in range(n):
yield i
i, j = j, i + j
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment