Discuss / Python / 改进版

改进版

Topic source

sword_v1

#1 Created at ... [Delete] [Delete and Lock User]
def triangles():
    b = [1]
    while True:
        yield b
        b = [x+y for x,y in zip(b+[0],[0]+b)]

厉害啊! 能请教下思路吗, 是怎么想到前后加0相加的?


  • 1

Reply