A generator is a function that produces values lazily, one at a time, using the yield keyword instead of return. It computes each value on demand rather than building the whole result in memory — ideal for large or infinite sequences.
yield vs return
():
[i ** i (n)]
():
i (n):
i **
sq gen_squares():
(sq)
