Discuss / Python / 感觉写的不太好。但是可以出答案

感觉写的不太好。但是可以出答案

Topic source

Pale219

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

def tri(): l1=[1,] yield(l1) while(True): n=len(l1) f = [1,] i=1 while i < n: f.append(l1[i-1]+l1[i]) i=i+1 f.append(1) l1 = f yield(f)

n=0 for t in tri(): print(t) n = n + 1 if n == 10: break


  • 1

Reply