In Python, the ____ keyword is used to define a generator function.
- def
- gen
- generator
- yield
In Python, the yield keyword is used to define a generator function. A generator function produces a sequence of values using the yield statement and can be paused and resumed during execution, allowing for efficient iteration over large data sets.
Loading...
Related Quiz
- How can you achieve inheritance in Python?
- Can you use a metaclass to modify the behavior of methods within its associated class? How?
- To debug Python scripts, you can use the ____ module to set breakpoints and inspect variable values.
- Which type of tree would you use to implement an ordered map?
- In Django, how would you extend the User model to include additional fields?