不太满意。学习一下大家的吧。
def triangles(): yield [1] yield [1,1] last = [1,1] while True: t = tuple(last) n = 1 while n < len(t): last[n] = t [n] + t[n-1] n = n+1 last.append(1) yield last[:]
Sign in to make a reply
Rayn-S
不太满意。学习一下大家的吧。