Python Program to Print Inverted Pyramid Star Pattern

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

# Python Program to Print Inverted Pyramid Star Pattern
 
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 Python Program prints the Inverted Pyramid Star Pattern using a while loop.

# Python Program to Print Inverted Pyramid Star Pattern
 
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.

# Python Program to Print Inverted Pyramid Star Pattern

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("Inverted Pyramid Star Pattern")
invertedStarPyramid(rows, ch)
Enter Inverted Pyramid Pattern Rows = 15
Symbol to use in Inverted Pyramid Pattern = ^
Inverted Pyramid Star Pattern
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
 ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
  ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
   ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
    ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
     ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ 
      ^ ^ ^ ^ ^ ^ ^ ^ ^ 
       ^ ^ ^ ^ ^ ^ ^ ^ 
        ^ ^ ^ ^ ^ ^ ^ 
         ^ ^ ^ ^ ^ ^ 
          ^ ^ ^ ^ ^ 
           ^ ^ ^ ^ 
            ^ ^ ^ 
             ^ ^ 
              ^ 
>>>