def gensquares(N): for i in range(N): yield i ** 2 # Resume here laterfor i in gensquares(5): # Resume the function print i, ':', # Print last yielded value
Name (required)
email (will not be published) (required)
Website