Python Program to Print Inverted Pyramid Star Pattern

Write a Python Program to Print Inverted Pyramid Star Pattern using a for loop.

rows = int(input("Enter Inverted Pyramid Pattern Rows = "))

print("Inverted Pyramid Star Pattern") 

for i in range(rows, 0, -1):
    for j in range(0, rows - i):
        print(end = ' ')
    for k in range(0, i):
        print('*', end = ' ')
    print()
Python Program to Print Inverted Pyramid Star Pattern 1

This Program prints the Inverted Pyramid Star Pattern using a while loop.

rows = int(input("Enter Inverted Pyramid Pattern Rows = "))

print("Inverted Pyramid Star Pattern") 

i = rows
while(i >= 1):
    j = 0
    while(j <= rows - i):
        print(end = ' ')
        j = j + 1
    k = 0
    while(k < i):
        print('*', end = ' ')
        k = k + 1
    i = i - 1
    print()
Enter Inverted Pyramid Pattern Rows = 14
Inverted Pyramid Star Pattern
 * * * * * * * * * * * * * * 
  * * * * * * * * * * * * * 
   * * * * * * * * * * * * 
    * * * * * * * * * * * 
     * * * * * * * * * * 
      * * * * * * * * * 
       * * * * * * * * 
        * * * * * * * 
         * * * * * * 
          * * * * * 
           * * * * 
            * * * 
             * * 
              * 

In this Python example, we created an invertedStarPyramid function to print the Inverted Pyramid Star Pattern. It replaces the star in a hollow Inverted Pyramid Star with a given symbol.

def invertedStarPyramid(rows, ch):
    for i in range(rows, 0, -1):
        for j in range(0, rows - i):
            print(end = ' ')
        for k in range(0, i):
            print('%c' %ch, end = ' ')
        print()

rows = int(input("Enter Inverted Pyramid Pattern Rows = "))

ch = input("Symbol to use in Inverted Pyramid Pattern = ")

print()
invertedStarPyramid(rows, ch)
Enter Inverted Pyramid Pattern Rows = 15
Symbol to use in Inverted Pyramid Pattern = ^

^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
 ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
  ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
   ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
    ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
     ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
      ^ ^ ^ ^ ^ ^ ^ ^ ^ 
       ^ ^ ^ ^ ^ ^ ^ ^ 
        ^ ^ ^ ^ ^ ^ ^ 
         ^ ^ ^ ^ ^ ^ 
          ^ ^ ^ ^ ^ 
           ^ ^ ^ ^ 
            ^ ^ ^ 
             ^ ^ 
              ^ 
>>>