Discuss / Python / 这个应该比较好理解吧

这个应该比较好理解吧

Topic source

鱿鱼

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

def triangles():

    lines = [1]

    while True:

        yield lines

        lastLine = lines

        newLine = [1,1]

        for i in range(1,len(lines)):

            value=lastLine[i-1]+lastLine[i]

            newLine.insert(i,value)

        lines=newLine


  • 1

Reply