for n in range(1000) a=n -------------------------------- def foo(num): print("starting...") while num<10: num=num+1 yield num for n in foo(0): print(n)