Question PRG-PY-0078
HardWhat is the difference between a list comprehension and a generator expression in memory use?
- A.
They are identical
- B.
List comprehensions are lazy
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Python question
What is the difference between a list comprehension and a generator expression in memory use?
They are identical
List comprehensions are lazy
Sign up free to see the answer and a step-by-step explanation.
Generators use more memory
A list comprehension builds the whole list; a generator produces items one at a time