#exemple 1
def fib():
a,b=0,1
while True:
yield b
a,b=b,a+b
f=fib()
print(type(f))
for i in range(20):
print(next(f),end=' ')
print()
#exemple 2
a = [0,1,2,3,4,5,6,7,8,9,10]
b = (x*x for x in a)
print(type(b))
for i in a: print(next(b),end=';')
b = (x*x for x in a)
print(type(b))
for i in a: print(next(b),end=';')
No hay comentarios:
Publicar un comentario