Fill in the blank
# returns a generator yielding squares of nums
def squares(nums):
for n in nums:
____ n * n
# list(squares([1,2,3])) -> [1,4,9]
Answer: yield
yield turns the function into a generator that produces each square.
Play Problem Solving ▸