Question 5
Back to Exercise
What happens when you call a generator function such as gen = countdown(3)?
- A The body runs completely and the values are stored
- B A generator object is returned and none of the body runs yet Correct
- C The body runs until the first yield
- D It raises StopIteration
Correct Answer: Option B
The body starts only at the first next() call.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!