python fibonacci generator

Python code posted
created at 27 May 18:46, updated at 27 May 18:46

Edit | Back
1
2
3
4
5
6
7
8
def fibonacci():
   """a generator for Fibonacci numbers, goes to next number in series on each call"""

   a, b = 0, 1

   while True:
      yield a
      a, b = b, a + b
178 Bytes in 2 ms with coderay