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 valuex = gensquares(10)print x.next()print x.next()print x.next()
Name (required)
email (will not be published) (required)
Website