Learn Before
Code

Python Program to Create Pyramid Patterns

#Creating a pyramid pattern in Python

#Specify the number of pyramid rows

rows = int (input ("Enter number of rows: "))

k = 0

for i in range (1, rows + 1):

for space in range (1, (rows-i) + 1): print (end=" ") while k! = (2*i - 1): print ("* ", end = "") k + = 1 k = 0 print()

0

1

Updated 2021-08-28

Tags

Python Programming Language

Data Science