Answer
yield is an expression that suspends a generator and produces a value to its caller. • The generator keeps its execution state while suspended. • A later next() or send() resumes execution. • Using yield in a function makes it a generator function.
💡 Simple Example
def values():
yield 1
yield 2
print(list(values()))
Output
[1, 2]
⚡ Quick Revision
yield emits a generator value and pauses execution state.