Inverted Full Pyramid

 Given an integer n as input, print an inverted full pyramid of n rows.

Input Format:

  • Take input an integer from stdin

Output Format:

  • Print the pattern

Example Input:
10

Output:

* * * * * * * * * * 
 * * * * * * * * * 
   * * * * * * * 
    * * * * * * 
     * * * * * 
      * * * * 
       * * * 
        * * 
         * 

 Solution:

n=int(input())
for i in range(n):
    for j in range(i):   # j for starting  spaces 
        print(" ",end="")
    for k in range(n-i): #k for stars in a line
        print("*",end=" ")
    print("")




Comments

Popular posts from this blog

Right Arrow Pattern

Efficient Janitor

X Pattern