Discuss / Python / 参考了前楼的代码,,

参考了前楼的代码,,

Topic source

吼kk

#1 Created at ... [Delete] [Delete and Lock User]

def triangles(max): n = 1 L = [1] while n<=max: yield L L1 = [0] + L + [0] L = [L1[x]+L1[x+1] for x in range(len(L1)-1)] n = n+1 return 'done'

for c in triangles(100): print(c)


  • 1

Reply