Python Program to Print Inverted Right Triangle of Numbers

In this article, we will show you, How to write a Python Program to Print Inverted Right Triangle of Numbers using For Loop and While Loop with example.

Python Program to Print Inverted Right Triangle of Numbers using For Loop

This Python program allows user to enter the total number of rows. Next, we used While Loop, and For Loop to print inverted right triangle of numbers from maximum value to 1.

# Python Program to Print Inverted Right Triangle of Numbers
rows = int(input("Please Enter the total Number of Rows : "))
print("Inverted Right Triangle Pattern of Numbers")
i = rows
while(i >= 1):
for j in range(1, i + 1):
print('%d ' %i, end = ' ')
i = i - 1
print()

OUTPUT

Python Inverted Right Triangle Program using While Loop

This inverted right triangle program is same as above. However, we replaced the For Loop with While Loop