Discuss / Python / ^(* ̄(oo) ̄)^第一行和第二行人肉输出

^(* ̄(oo) ̄)^第一行和第二行人肉输出

Topic source

千年C

#1 Created at ... [Delete] [Delete and Lock User]
def triangles():
    yield [1]
    yield [1,1]
    U = [1,1]
    L=[]
    while 1:
        for i,j in enumerate(U):
            if i<len(U)-1:
                L.append(U[i]+U[i+1])
        L = [1]+L+[1]
        yield L
        U = L
        L = []

  • 1

Reply