def triangles(max): n = 1 L = [1] while n<=max: yield L L1 = [0] + L + [0] L = [L1[x]+L1[x+1] for x in range(len(L1)-1)] n = n+1 return 'done'
for c in triangles(100): print(c)
Sign in to make a reply
吼kk
def triangles(max): n = 1 L = [1] while n<=max: yield L L1 = [0] + L + [0] L = [L1[x]+L1[x+1] for x in range(len(L1)-1)] n = n+1 return 'done'
for c in triangles(100): print(c)