from itertools import *
Return a count object where on every .next()
call will return start + step, start * 1 + step, start * 2 + step ...
count() # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ... ]
count(10) # [10, 11, 12, 13, 14, 15, 16, 17, 18 ... ]
count(10, 2) # [10, 12, 14, 16, 18, 20, 22, 24, 26 ... ]
count(10, -2) # [10, 8, 6, 4, 2, 0, -2, -4, -6, -8 ... ]
Return the sequence of the iterable until the end and then repeat indefinitely.
cycle([0, 0, 1]) # [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0 ... ]
cycle([1, 2, 3]) # [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2 ... ]
cycle([1]) # [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ... ]