Question 7
Back to Exercise
Why does a generator over a billion numbers use very little memory?
- A It produces one value at a time when asked instead of storing them all Correct
- B It compresses the numbers
- C It stores the numbers on disk
- D Python limits generators to 1000 values
Correct Answer: Option A
Only the generator's current state (its local variables) is kept.
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!