I was trying python's generators (together with from) but endup with infinite loop. My python version is python3. why did I stuck into infinite loop?
Below is my code:
def fib2():
a,b = 0,1
while True:
yield a
a,b = b , a+b
def FibNumber(num):
fi2= fib2()
for i in range(num):
yield from fi2
if (__name__ == "__main__"):
fin = FibNumber(10)
for i in fin:
print (i)