Skip to content

Instantly share code, notes, and snippets.

@hoangddt
Created January 5, 2018 04:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hoangddt/76db0c1078f41ea51221e14592b2d9e3 to your computer and use it in GitHub Desktop.
Save hoangddt/76db0c1078f41ea51221e14592b2d9e3 to your computer and use it in GitHub Desktop.
Fibonacci implementation in python as Genarator
def fib():
a = 0
b = 0
while True:
if b == 0:
yield 1
b = 1
continue
a, b = b, a + b
yield b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment