Intermediate Python
Q41 / 101

What is a generator in Python?

Correct! Well done.

Incorrect.

The correct answer is B) A function using yield to produce values lazily, one at a time

B

Correct Answer

A function using yield to produce values lazily, one at a time

Explanation

Generators use yield to lazily produce values, consuming O(1) memory regardless of the sequence length. They are iterable but not reusable.

Progress
41/101