fork download
  1. import itertools
  2.  
  3. def fib():
  4. a, b = 0, 1
  5. while True:
  6. yield a
  7. a, b = b, a+b
  8.  
  9. print itertools.islice(fib(), 20)
Success #stdin #stdout 0s 9024KB
stdin
Standard input is empty
stdout
<itertools.islice object at 0x55a17a2c>