← Quiz: Iterators and Generators: all 10 questions
Quiz: Iterators and Generators · Question 9 of 10
What does yield from [4, 5] do inside a generator?
What does yield from [4, 5] do inside a generator?
- A.Yields the list [4, 5] as one value
- B.Yields 4 and then 5, one at a time
- C.Returns the list and ends the generator
- D.Raises a SyntaxError
Answer & explanation
Correct answer: Yields 4 and then 5, one at a time
yield from hands out every item of the iterable separately.
Can you get the rest right without peeking?
Take the timed Quiz: Iterators and Generators quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →