Discuss / Python / 交作业

交作业

Topic source

weareguyshot

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

def triangles(n): l=[1] num=1 while num<=n: yield l l1=[0]+l l2=l+[0] l=[l1[i]+l2[i] for i in range(len(l1))] num=num+1 for i in triangles(10): print i


  • 1

Reply