Discuss / Python / ..脑子阻塞,也能达到效果``

..脑子阻塞,也能达到效果``

Topic source

我是chenv

#1 Created at ... [Delete] [Delete and Lock User]
def triangles():
    m,n, a=0, 0, [1]
    while True:
        b = [1]
        yield a
        if n > 0:
            m = n
            while m > 0:
                b.append(a[m]+a[m-1])
                m = m -1
        b.append(1)
        a = b
        n = n + 1

  • 1

Reply