#itertools.count()- creates an iterator which yields infinite sequence of integers from a starting point from itertools import count seq = count(0, 2) #an infinite sequence of even numbers print(next(seq)) print(next(seq)) print(next(seq)) print(next(seq)) print(next(seq))
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter