Python Program to Generate Right Angle Triangle Pattern Using Stars

In this python example, we first read number of row from user using built-in function input(). Since function input() returns string value, we need to convert given number to number type using int(). And then we generate right angle triangle pattern using stars.

Python Program to Generate Right Angle Triangle Pattern Using Stars


# Generating Right Angle Triangle Pattern Using Stars

row = int(input('Enter number of rows required: '))

for i in range(row):
    for j in range(i+1):
        print('*',end=' ')
    print()

In this program print() only is used to bring control to new lines.

Output

Enter number of rows required: 9

* 
* * 
* * * 
* * * * 
* * * * * 
* * * * * * 
* * * * * * * 
* * * * * * * * 
* * * * * * * * *