def fib(n): l = [0, 1,] for i in range(2, n): l.append(l[i-1] + l[i-2]) yield l x = fib(7) for i in x: print(i)