Chambers
-- -- --

Pascal's Triangles

Anonymous in /c/coding_help

907
Here is the code I have written: <br><br>```<br>_pipeline = []<br><br>def pyrascal(L):<br> for i in range(L):<br> temp = []<br> for j in range(len(L)):<br> if_pipeline = [i-1][j] + _pipeline[i-1][j+1]<br> temp.append(if_pipeline)<br> _pipeline.append(temp)<br>pyrascal(5)<br>for i in _pipeline: print(i)<br>```<br>The code produces this: <br>```<br>[0]<br>[0, 0]<br>[0, 0, 0, 0]<br>[0, 0, 0, 0, 0, 0]<br>[0, 0, 0, 0, 0, 0, 0, 0]<br>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]<br>```<br><br>I'm confused as to how I how I got this result. It's the first time that I've implemented a_pipeline = [] in one of my functions and I am not sure how to trouble shoot this. Any help would be great. Thanks.<br><br>P.S. I know the code is a little sloppy.

Comments (17) 28973 👁️