fork download
  1. enum_ = (lambda it,
  2. zip_ = lambda xs, ys: map(lambda x, y=iter(ys): (x, next(y)), xs),
  3. count_ = iter(
  4. lambda x=[-1]: x.__setitem__(-1, x[-1] + 1) or x[-1],
  5. None
  6. )
  7. : zip_(count_, it)
  8. )
  9.  
  10. print(*enum_(range(2, 20, 2)))
Success #stdin #stdout 0.03s 9440KB
stdin
Standard input is empty
stdout
(0, 2) (1, 4) (2, 6) (3, 8) (4, 10) (5, 12) (6, 14) (7, 16) (8, 18)