Discuss / Python / 交作业

交作业

Topic source

def triangles(): n, a = 0, 1 L = [1] Y = [1] while n >= 0: yield Y if len(L) > 1: Y = [1, 1] [Y.insert(-1, L[idx] + L[idx+1]) for idx in range(len(L)) if idx < len(L) -1] else: Y = [1, 1] L = Y n = n + 1


  • 1

Reply