Yield ussage to return output function while is creating a list generator.
# define yield function
def fyield(nn):
# loop
for i,inn in enumerate(range(n)):
# return
yield [i,inn+1]
# launch
nn = 3
out = fyield(nn)
list(out)
#[out]: [[0,1],[1,2],[2,3]]