L = [1]
while True:
yield L
L = [L[x]+L[x+1] for x in range(len(L)-1)]
L.insert(0,1)
L.append(1)
#借鉴了其他教程,自己啥时才写得出来。。。
先用复杂的方法实现,然后再慢慢考虑精简代码,可能是比较好的方式
谢谢?
Sign in to make a reply
Mario7788
L = [1]
while True:
yield L
L = [L[x]+L[x+1] for x in range(len(L)-1)]
L.insert(0,1)
L.append(1)
#借鉴了其他教程,自己啥时才写得出来。。。