在此插入代码
def triangles(): L = [1] while 1: yield L L = [1] + [L[x-1] + L[x] for x in range(1,len(L))] + [1] n = 0 for t in triangles(): print(t) n += 1 if n == 10: break
Sign in to make a reply
阳光明媚-M
def triangles(): L = [1] while 1: yield L L = [1] + [L[x-1] + L[x] for x in range(1,len(L))] + [1] n = 0 for t in triangles(): print(t) n += 1 if n == 10: break