Discuss / Python / 来一个更简洁点的~

来一个更简洁点的~

Topic source
def triangles():
    b = [1]
    while True:
        yield b
        b.insert(0, 0)
        for x in range(len(b[:-1])):
            b[x] += b[x + 1]
g = triangles()
for n in range(3):
    print(next(g))

  • 1

Reply