def f(): a = 1 if a < 10: yield a a += 3 instance1 = f() print(next(instance1)) print(next(instance1)) print(next(instance1))