def triangles(): L = [1] yield L while True: L.append(1) yield L L = [L[i-1]+L[i] for i in range(1,len(L))] L.insert(0,1)
赞!
跟我想法一样
def triangles(): L = [1] while True: yield L L=[1]+[L[x-1]+L[x] for x in range(1,len(L))]+[1]
Sign in to make a reply
0泡老醋
def triangles(): L = [1] yield L while True: L.append(1) yield L L = [L[i-1]+L[i] for i in range(1,len(L))] L.insert(0,1)