The result of below program is
2 step 3 step 5 step 7 step
How does yield run? What does yield return, by n
or it's generator
?
Why isn't number 9's answer the result (2 step 3 step 5 step 7 step step
)?
Can you explain how the program is run?
def _odd_iter():
n = 1
while True:
n = n+2
yield n
def _not_divisible(n):
return lambda x:x%n >0
def primes():
yield 2
it = _odd_iter()
while True:
print('step')
n = next(it)
yield n
it = filter(_not_divisible(n),it)
c = primes()
for i in c:
if i<10:
print(i)
else:
break