Discuss / Python / 初学python

初学python

Topic source
def tri():
    a = [1]
    yield a
    while True:
        l = len(a) + 1
        a = [1 if i==0 or i==l-1 else a[i-1] + a[i] for i in range(l)]
        yield a
    return 'done'

  • 1

Reply