Practice mode Python

What does itertools.chain(, ) produce when iterated?

Correct answer A. 1, 2, 3

Explanation

itertools.chain() returns an iterator that yields every element of the first iterable, then every element of the next, and so on, treating several sequences as one continuous stream. It does not pair items like zip() and does not nest them. It is lazy, so nothing is copied up front.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.