def triangles(): n, list1, list2 = 0, [], [1] while True: for i in range(n): if i == n-1: list2.append(1) else: list2.append(list1[i] + list1[i+1]) yield list2 list1, list2 = list2, [1] n = n+1
Sign in to make a reply
我不吃小孩子