def triangles(): L = [1] while True: yield L L.append(0) L = [L[i - 1] + L[i] for i in range(len(L))] n = 0for t in triangles(): print(t) n = n + 1 if n == 10: breakL = [L[i - 1] + L[i] for i in range(len(L))] 这一段列表生成怎么理解,i一开始不应该是0吗,那L[i-1]不就是L[-1]?哪里理解的不对呢
添加回答
举报
0/150
提交
取消