def add(n,i): return n+i def test(): for i in range(4): yield i g=test() for n in [1,10]: #n=10 g=(add(n,i) for i in g) # 第一次循环: # g=(add(n,i) for i in test()) # 第二次循环: # g=(add(n, i) for i in (add(n,i) for i in test())) # print(n) res=list(g) # 迭代器1=(add(n,i) for i in test()) # for i in 迭代器1: #i=next(迭代器1) i=11 # add(n, i) #add(10,11) print(res) #A. res=[10,11,12,13] #B. res=[11,12,13,14] #C. res=[20,21,22,23] #D. res=[21,22,23,24]