Python Program to Print Hollow Right Angle Triangle Star Pattern
This python program generates hollow right angle triangle pattern made of stars up to n lines.
In this python example, we first read number of row in the hollow right angle triangle pattern from user using built-in function input()
. And then we generate hollow right angle triangle pattern using python's for loop.
Python Source Code: Hollow Right Angle Triangle Pattern
# Hollow 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):
if j==0 or j==i or i==row-1:
print('*',end=" ")
else:
print(" ", end=" ")
print()
In this program print()
only is used to bring control to new lines.
Output
Enter number of rows required: 8 * * * * * * * * * * * * * * * * * * * * *