Program to Print Half Pyramid in Python language
ADVERTISEMENTS
Program to print half pyramid in python language of stars. In this program, you will learn how to print half pyramid in python language.
Source Code
# Program to Print Half Pyramid in Python language
r, i, j = 0, 0, 0
# r - the number of rows
print ("-----To print the half pyramid enter the number of rows-----")
r = int (input ())
print (end="\n")
for i in range (1, r + 1):
for j in range (1, i + 1):
print (end="* ")
print (end="\n")
Output
-----To print the half pyramid enter the number of rows-----
7
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *