I have found the below piece of code on the internet, with the actual output
def countdown(start):
print start
if start == 0:
yield 0
else:
yield countdown(start -1)
g = countdown(3)
g.next()
g.next()
the output of the code is
3
StopIteration
Can anyone break this code down for me, Is next()
skipping the sequence of the generator? I can't seem to understand the flow here