## Python 3 Script to Print Pascal’s Triangle Pattern Upto n Rows Using Recursion Full Project For Beginners Welcome folks today in this blog post we will be `printing pascal's triangle pattern upto n rows in python using recursion.`All the full source code of the application is given below.

# Get Started

In order to get started you need to make an `app.py` file and copy paste the following code

`Using Recursion`

`app.py`

``````import sys

# Recursive method to create the mathematical series
def pascal(col,row):
if(col == 0) or (col == row):
return 1
else:
return pascal(col-1,row-1) + pascal(col,row-1)

# Method returns the results of n rows in the triangle
def PascalTriangle(num):
if (num <= 0):
print('Number must be greater than zero')

for r in range(num):
for c in range(r+1):
sys.stdout.write(str(pascal(c,r))+' ')
sys.stdout.write('\n')

#Test Section
PascalTriangle(10)``````

See also  Python 3 PyOpenGL Script to Implement Bezier Curve Fitting Full Project For Beginners

Now if you execute the `python` script by typing the below command as shown below

`python app.py` 