Discuss / Python / 想了想

想了想

Topic source

def triangles(maxi): idx = 1 a,b=[1],[1,1] while idx <= maxi: yield a
a,b=b,[1]+[b[i]+b[i+1] for i in range(len(b)-1)]+[1] idx +=1

for t in triangles(10): print(t)

孙小二wuk

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

写的越简单, 看起来越累

孙小二wuk

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

写的好,精彩


  • 1

Reply