> Need help with creating non-right Pascal's triangle (centered) in Python 2.7?

Need help with creating non-right Pascal's triangle (centered) in Python 2.7?

Posted at: 2014-12-18 
The code that I created can be seen in the picture. When I input a number greater or equal than 5, the code no longer outputs a Pascal's triangle. What could be wrong?



I tried to execute your image but I couldn't paste it into Notepad

You can use code-posting sites like ideone.com or codepad.org, or you can paste your text into your question, but remember that Y!A removes leading blanks so you can use "--- " for each indentation level.

Edit: OK, I ran your code with 5 and 6. The first 5 rows of the 6-row triangle look the same, so I'm assuming you are saying the 6th row is bad.

I never memorized the definition of Pascal's triangle, so now I have to look it up.

For future reference, when you ask questions here, you shouldn't make us do more work than we need to to understand what your problem is.

Edit: OK, I see you said >=5, so row 5 is incorrect also.

Edit: OK, I see that your theory is that 11**x should produce the correct answer.

I checked what MS Excel calculates and it calculates the same values as Python, so, it seems your theory breaks down.

I'm not an expert in such tricky ways to do Pascal's triangle. (I'm not really all that familiar with the standard ways of doing it.) So, at the moment, I'm not sure where you got your 11**x concept from.

So, at this point, it doesn't seem to be a problem with Python, or turning your concept into Python. The concept of your algorithm *seems* to be wrong.

Edit: So, it seems that 4+6 = 10, so the 1 carries over to the next digit and that's your problem.

The code that I created can be seen in the picture. When I input a number greater or equal than 5, the code no longer outputs a Pascal's triangle. What could be wrong?