def triangles(): list = [] while True: n = len(list) if n >= 2: m = 0 ranges = n - 1 while m < ranges: list[m] += list[m+1] m += 1 list.insert(0, 1) yield list
Sign in to make a reply
BLOODY-SINNER
def triangles(): list = [] while True: n = len(list) if n >= 2: m = 0 ranges = n - 1 while m < ranges: list[m] += list[m+1] m += 1 list.insert(0, 1) yield list