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

8 lines
147 B
Python

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