Discuss / Python / 可以帮我看下为什么用了append和assert,输出两端多了0,我断点打出来感觉没有错的呀

可以帮我看下为什么用了append和assert,输出两端多了0,我断点打出来感觉没有错的呀

Topic source

轻涉世

#1 Created at ... [Delete] [Delete and Lock User]
def triangles():    L = [1]    yield L    while True:        L.insert(0, 0)        L.append(0)        L = [L[i] + L[i+1] for i in range(len(L) - 1)]        L = L        yield L

  • 1

Reply