Discuss / Python / 好难呀 想了好久

好难呀 想了好久

Topic source

Z小龙zxl

#1 Created at ... [Delete] [Delete and Lock User]

def triangles():

    n = [1]

    while True:

        yield n

        n = [x+y for x,y in zip([0] + n,n+[0])]

j = 0

for t in triangles():

    print(t)

    j = j + 1

    if j == 10:

        break


  • 1

Reply