Write a Python Program to Print Pyramid Star Pattern using a for loop. This example uses multiple for loops nested inside another to print the Pyramid pattern.
rows = int(input("Enter Pyramid Pattern Rows = "))
print("Pyramid Star Pattern")
for i in range(0, rows):
for j in range(0, rows - i - 1):
print(end = ' ')
for k in range(0, i + 1):
print('*', end = ' ')
print()

In this example, we twisted the for loops to print the Pyramid star pattern.
rows = int(input("Enter Pyramid Pattern Rows = "))
for i in range(1, rows + 1):
for j in range(1, rows - i + 1):
print(' ', end = '')
for k in range(1, (2 * i)):
print('*', end = '')
print()
Enter Pyramid Pattern Rows = 15
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
*********************
***********************
*************************
***************************
*****************************
>>>
In this Program, the pyramidStar function prints the Pyramid Pattern of a given symbol.
def pyramidStar(rows, ch):
for i in range(0, rows):
for j in range(0, rows - i - 1):
print(end = ' ')
for k in range(0, i + 1):
print('%c' %ch, end = ' ')
print()
rows = int(input("Enter Pyramid Pattern Rows = "))
ch = input("Symbol to Print in Pyramid Pattern = ")
pyramidStar(rows, ch)
Enter Pyramid Pattern Rows = 12
Symbol to Print in Pyramid Pattern = #
#
# #
# # #
# # # #
# # # # #
# # # # # #
# # # # # # #
# # # # # # # #
# # # # # # # # #
# # # # # # # # # #
# # # # # # # # # # #
# # # # # # # # # # # #
>>>