def triangles():
L2=[1]
yield L2
L2=[1,1]
row=3
while True:
i=0
L1=L2
while(i<row-2):
L2.append(L1[i]+L1[i+1])
i=i+1
L2.append(1)
row=row+1
Sign in to make a reply
南风
def triangles():
L2=[1]
yield L2
L2=[1,1]
yield L2
row=3
while True:
i=0
L1=L2
L2=[1]
while(i<row-2):
L2.append(L1[i]+L1[i+1])
i=i+1
L2.append(1)
yield L2
row=row+1