Instagram
youtube
Facebook
Twitter

Python Program to Print Inverted Half Pyramid Pattern

         A Python Program to Print Inverted Half Pyramid Pattern

          
        Short Description:
        This program prints an inverted half pyramid pattern using asterisk (*).
        It starts with the maximum number of stars and decreases by one in each subsequent       row.

        Explanation:

  • rows is the number of total rows.
     
  • The loop runs in reverse from rows down to 1.
     
  • In each iteration, it prints i stars (*), where i decreases with each row.
     
  • No spaces are added; the stars align to the left, forming an upside-down triangle.

       Program:

 

num = int(input('Enter a number: '))

for i in range(num,0,-1):

    print("* "*i)