Problem Statement
Why choose a generator expression over a list comprehension?
Explanation
A generator expression yields one item at a time. This keeps memory low for large streams or pipelines.
A list comprehension builds the whole list in memory first, which is fine for small data but expensive for huge inputs.
Code Solution
SolutionRead Only
total = sum(x*x for x in range(10_000_000))
