Discuss / Python / Answer from Maplin 2022-11-22

Answer from Maplin 2022-11-22

Topic source

>>> def triangles():

...     L = [1]

...     while True:

...             yield L

...             L = [1] + [L[n] + L[n+1] for n in range(len(L)-1)] + [1]

...


  • 1

Reply