Python count Iterator

Python count(begin [,step]) iterator loops from begin, begin+step, begin + 2 * step, ... for ever, till keyword break stop the loop.

>>> from itertools import *
>>> x = count(10)
>>> for n in x:
... if (n==14): break
... print(n)
...
10
11
12
13






















endmemo.com © 2024  | Terms of Use | Privacy | Home