Pascal's Triangle with Python |
The above simulation is produced in Python with aid of three functions.
They are as follows:
- Factorial function
- A function to generate combinations - nCr
- A function to produce the Pascal's Triangle
You can practise it interactively with the following simulation. Please make sure you keep the number of rows below 10 so that the format of the output stays the way it should.
The number of rows is the only parameter that Pascal(n) function needs.
0 comments:
Post a Comment