>>> from multseq import productes_seq --ini-enunciat >>> it = productes_seq([2, 3, 5], [10, 20, 30, 70, 20]) >>> for r in it: ... print(r, end=',') 20,60,150,70,20, >>> next(it, 'final') # comprovació que l'iterador s'ha exhaurit 'final' --fi-enunciat >>> list(productes_seq(iter(range(10)), iter(range(6)))) [0, 1, 4, 9, 16, 25, 6, 7, 8, 9] >>> list(productes_seq(range(10), range(40, 3, -2))) [0, 38, 72, 102, 128, 150, 168, 182, 192, 198, 20, 18, 16, 14, 12, 10, 8, 6, 4] >>> list(productes_seq(range(1,10,3), range(1,20,2))) [1, 12, 35, 7, 9, 11, 13, 15, 17, 19] Comprovació que la funció és capaç de treballar amb iteradoors infinits >>> import itertools >>> it1 = itertools.count(5, 2) >>> it2 = itertools.repeat(10) >>> it3 = productes_seq(it1, it2) >>> list(itertools.islice(it3, 0, 10)) [50, 70, 90, 110, 130, 150, 170, 190, 210, 230]