Discuss / Python / 参考了评论区

参考了评论区

Topic source

langangang

#1 Created at ... [Delete] [Delete and Lock User]
def triangles():
    a = [1]
    while True:
        yield a
        a = [1] + [a[i] + a[i+1] for i in range(len(a)) if len(a) >= 2 and i < len(a) - 1] + [1]

  • 1

Reply