Iteration Classes
itertools.count()
Produce an unbounded arithmetic progression. Bound consumption with islice or a loop; floating steps can accumulate rounding error.
Formal Syntax & Structure
python syntaxpython
itertools.count(start=0, step=1)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| start | int or number | Starting position or value. |
| step | int or number | Increment or stride. |
Return Value
iterator
The iterator result described above.
Working Example
Example Snippetpython
import itertoolsprint(list(itertools.islice(itertools.count(3,2),4)))