Discuss / Python / 第一版,写的好复杂。。。

第一版,写的好复杂。。。

Topic source

_盛盛_

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

def triangles(): x = 100 m = 1 i = 2 L1 = [1] yield(L1) L2 = [1,1] while i <= x: L1 = [1] j = 1 while j <= m: if not j == m: L1.append(L2[j] + L2[j-1]) else: L1.append(1) j = j + 1 yield(L1) L2 = L1 m = m +1 i = i + 1


  • 1

Reply