Discuss / Python / 练习

练习

Topic source
def triangles():
    n=1
    tt=[0]
    while True:
        L=[]
        while j in range(n) :
            if j==0 :
                L.append(1)
            elif j==n-1 and n>=2 :
                L.append(1)
            else :
                L.append(t[j-1]+t[j])
        tt=L
        yield tt
        n=n+1

  • 1

Reply