Python Program to Print Inverted Triangle Numbers Pattern

Write a Python program to print inverted triangle numbers pattern using for loop.

rows = int(input("Enter Inverted Triangle Number Pattern Rows = "))

print("====The Inverted Triangle Numbers Pattern====")

for i in range(1, rows + 1):
    for j in range(1, i):
        print(end = ' ')
    for k in range(1, rows - i + 2):
        print(k, end = ' ')
    print()
Python Program to Print Inverted Triangle Numbers Pattern

This Python example displays the inverted triangle pattern of numbers using a while loop.

rows = int(input("Enter Inverted Triangle Number Pattern Rows = "))

print("====The Inverted Triangle Numbers Pattern====")
i = 1

while(i <= rows):
    j = 1
    while(j < i):
        print(end = ' ')
        j = j + 1
    k = 1
    while(k <= rows - i + 1):
        print(k, end = ' ')
        k = k + 1
    print()
    i = i + 1
Enter Inverted Triangle Number Pattern Rows = 13
====The Inverted Triangle Numbers Pattern====
1 2 3 4 5 6 7 8 9 10 11 12 13 
 1 2 3 4 5 6 7 8 9 10 11 12 
  1 2 3 4 5 6 7 8 9 10 11 
   1 2 3 4 5 6 7 8 9 10 
    1 2 3 4 5 6 7 8 9 
     1 2 3 4 5 6 7 8 
      1 2 3 4 5 6 7 
       1 2 3 4 5 6 
        1 2 3 4 5 
         1 2 3 4 
          1 2 3 
           1 2 
            1