What is the primary use of a generator expression in Python?

  • To create a dictionary.
  • To create a list of values.
  • To create a new generator object.
  • To modify an existing generator.
The primary use of a generator expression in Python is to create an iterable generator object. Generator expressions are memory-efficient and generate values on-the-fly, making them useful for working with large datasets.
Add your answer
Loading...

Leave a comment

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