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.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *