Tuesday, 27 December 2022

Pascal's Triangle in Python for Computer Science: GCSE, IGCSE and A Level

Pascal's Triangle with Python
Pascal's Triangle with Python



 

Pascal's Triangle in Python

The above simulation is produced in Python with aid of three functions.

They are as follows:
  1. Factorial function 
  2. A function to generate combinations - nCr
  3. 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