def triangles():
s = []
while True:
if len(s) == 0:
s.append(1)
else:
x = s
s = [1]
k = 0
while k < len(x) - 1:
s.append(x[k] + x[k + 1])
k = k + 1
yield s
Sign in to make a reply
哒哒大萌
def triangles():
s = []
while True:
if len(s) == 0:
s.append(1)
else:
x = s
s = [1]
k = 0
while k < len(x) - 1:
s.append(x[k] + x[k + 1])
k = k + 1
s.append(1)
yield s