Files
cursopython2023/aula91.py
2022-11-04 10:17:34 -03:00

16 lines
278 B
Python

# Introdução às Generator functions em Python
# generator = (n for n in range(1000000))
def generator(n=0, maximum=10):
while True:
yield n
n += 1
if n >= maximum:
return
gen = generator(maximum=1000000)
for n in gen:
print(n)