Python: In Python, which comparison about Iterators, Generators, and yield is accurate?

Difficulty:

Easy

Questions:

1

Time Limit:

2 minutes

Passing Score:

100%

Question

In Python, which comparison about Iterators, Generators, and yield is accurate?

  1. There is no practical difference in behavior, performance, or maintainability when Iterators, Generators, and yield is involved.
  2. The oldest option related to Iterators, Generators, and yield is always the right production choice regardless of workload or context.
  3. Generators trade immediate materialization for lazy production, while lists trade memory for simpler repeated consumption.
  4. Differences around Iterators, Generators, and yield are mostly cosmetic, so correctness and debugging quality do not really change.

Hint

Focus on the behavior or tradeoff, not just the keyword.

Answer and rationale

Correct answer: C. Generators trade immediate materialization for lazy production, while lists trade memory for simpler repeated consumption.

Generators trade immediate materialization for lazy production, while lists trade memory for simpler repeated consumption. This is the comparison that usually separates memorization from understanding.

Track: Python