Discuss / Python / 交作业:

交作业:

Topic source

def triangles():

    L = [1]

    while 1:

        yield L

        L = [L[n] + L[n+1] for n in range(len(L) - 1)]

        L.insert(0,1)

        L.append(1)


  • 1

Reply