yield — Expert Playground
Pauses a generator function and produces a value to the caller
Python Playground
Output
Click "Run" to execute your codegen.send(value) resumes the generator and passes a value in through the yield expression. This enables coroutine-style bidirectional communication.
Challenge
Try modifying the code above to explore different behaviors. Can you extend the example to handle a new use case?