Answer to Question #241044 in Python for saksham

Question #241044
Inverted pyramid pattern of numbers
An inverted pyramid is a downward pattern where numbers get reduced in each iteration, and on the last row, it shows only one number. Use reverse for loop to print this pattern.
1
Expert's answer
2021-09-24T18:58:12-0400
n = int(input())
for i in range(n,0,-1):
    for j in range(n-i):
        print(' ', end='') 
    
    for j in range(2*i-1):
        print(i,end='') 
    print() 

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS