Python Online Compiler
Example: Program to Print Half Pyramid in Python language
C
C++
C#
Java
Python
PHP
main.py
STDIN
Run
# 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")
7
Output
Clear
ADVERTISEMENTS