fork download
  1. def gfib(n):
  2. a = 1
  3. b = 1
  4. while a < n:
  5. yield a
  6. a, b = b, a + b
  7.  
  8. if __name__ == '__main__':
  9. for v in gfib(20):
  10. print(v, end=' ')
  11.  
Success #stdin #stdout 0.03s 9096KB
stdin
Standard input is empty
stdout
1 1 2 3 5 8 13