Write a Python Program to print Inverted Right Triangle Star Pattern with a practical example.
Python Program to Print Inverted Right Triangle Star Pattern using While Loop
This Python program allows user to enter the total number of rows. Next, we used Python Nested While Loop to print inverted right angled triangle of stars.
# Python Program to Print Inverted Right Triangle Star Pattern rows = int(input("Please Enter the total Number of Rows : ")) print("Inverted Right Angle Triangle of Stars") i = rows while(i > 0): j = i while(j > 0): print('* ', end = ' ') j = j - 1 i = i - 1 print()
Python Program to Print Inverted Right Triangle of Stars Example 2
This Python program allows user to enter his/her own character. Next, it prints the inverted right triangle of user-specified character.
# Python Program to Print Inverted Right Triangle Star Pattern rows = int(input("Please Enter the total Number of Rows : ")) ch = input("Please Enter any Character : ") print("Inverted Right Angle Triangle of Stars") i = rows while(i > 0): j = i while(j > 0): print('%c' %ch, end = ' ') j = j - 1 i = i - 1 print()
Please Enter the total Number of Rows : 15
Please Enter any Character : $
Inverted Right Angle Triangle of Stars
$ $ $ $ $ $ $ $ $ $ $ $ $ $ $
$ $ $ $ $ $ $ $ $ $ $ $ $ $
$ $ $ $ $ $ $ $ $ $ $ $ $
$ $ $ $ $ $ $ $ $ $ $ $
$ $ $ $ $ $ $ $ $ $ $
$ $ $ $ $ $ $ $ $ $
$ $ $ $ $ $ $ $ $
$ $ $ $ $ $ $ $
$ $ $ $ $ $ $
$ $ $ $ $ $
$ $ $ $ $
$ $ $ $
$ $ $
$ $
$
>>>