MemotivaComprehensions and functional tools

What does itertools.chain do?

Nortren·

What does itertools.chain do?

0:14

Chain takes multiple iterables and produces their elements in sequence, as if they were a single iterable. It is the lazy equivalent of concatenating lists. Chain.from_iterable takes a single iterable of iterables and chains them, useful for flattening one level.
docs.python.org