Skip to content

Instantly share code, notes, and snippets.

@hanx11
Last active October 19, 2019 11:47
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 hanx11/1d414565fe561f92b205c33532ba0b0b to your computer and use it in GitHub Desktop.
Save hanx11/1d414565fe561f92b205c33532ba0b0b to your computer and use it in GitHub Desktop.
# -*- coding:utf-8 -*-
def fib(n):
a, b = 0, 1
for _ in range(n):
yield a
a, b = b, a + b
if __name__ == '__main__':
print(list(fib(100)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment