PRACTICE / UNDERSTAND / REPEAT
Python practice question
Practice generators with self-contained questions. Check your answer, then use the explanation to understand the reasoning.
1 questionAnswers explainedFree · no login
Try this question
What does `yield` do inside a function?
Answer & explanation
Answer: Produces a value and suspends the generator
`yield` produces a value while preserving generator state for the next iteration.