1 2 3 4 5 6 7
from itertools import chain, count, cycle, repeat from operator import add fizz = cycle(chain(['Fizz'], repeat('', 2))) buzz = cycle(chain(['Buzz'], repeat('', 4))) fzbz = map(add, fizz, buzz) for fb, n in zip(fzbz, count()): print(fb or n)