Renders a pascal triangle up to a specified line. Useful to solve (a+b)^n type stuff
B=[1,0] C=[1] n=int(input("Max line:\n")) i=0 while i<n+1: if i+1==len(B): print(str(i)+": "+str(C)) C.append(0) B=C C=[1] i=-1 else:C.append(B[i]+B[i+1]) i+=1
Create, edit, and import your Python scripts
Renders a pascal triangle up to a specified line. Useful to solve (a+b)^n type stuff
B=[1,0] C=[1] n=int(input("Max line:\n")) i=0 while i<n+1: if i+1==len(B): print(str(i)+": "+str(C)) C.append(0) B=C C=[1] i=-1 else:C.append(B[i]+B[i+1]) i+=1