def triangles():
ls1=[1]
ls2=[1,1]
yield ls1
yield ls2
lsc=ls2
while True:
lsn=[]
lsn.append(lsc[0])
n=len(lsc)+1
for i in range(1,n-1):
lsn.append(lsc[i-1]+lsc[i])
lsn.append(lsc[-1])
yield lsn
lsc=lsn
Sign in to make a reply
⑨
def triangles():
ls1=[1]
ls2=[1,1]
yield ls1
yield ls2
lsc=ls2
while True:
lsn=[]
lsn.append(lsc[0])
n=len(lsc)+1
for i in range(1,n-1):
lsn.append(lsc[i-1]+lsc[i])
lsn.append(lsc[-1])
yield lsn
lsc=lsn