Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

itertools - count

  • Unbound counter: Count from N to infinity.
import itertools

for c in itertools.count(start=19, step=1):
    print(c)
    if c > 23:
        break

# 19
# 20
# 21
# 22
# 23
# 24