Files
Learn-Python-Programming-Th…/ch05/gen.yield.from.py
T
adii1823 ef37ce0c4e ch05
2021-10-28 17:38:16 +05:30

7 lines
146 B
Python

# gen.yield.from.py
def print_squares(start, end):
yield from (n ** 2 for n in range(start, end))
for n in print_squares(2, 5):
print(n)