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
Sign in to make a reply
Pale219
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