;

Python Program to Print the Inverted Right Triangle Star Pattern


Tutorialsrack 16/05/2020 Python

In this python program, we will learn how to print the inverted right-angled triangle star pattern.

Here is the source code of the program to print the inverted right-angled triangle star pattern.

Program 1: Python Program to Print the Inverted Right Triangle Star Pattern Using While and For Loop

Python Program to Print the Inverted Right Triangle Star Pattern Using While and For Loop
# Python Program to Print the Inverted Right Triangle
# Star Pattern Using While and For Loop

# Take the Input from the User
rows = int(input("Enter the total Number of Rows: "))

# Print the Output
print("Inverted Right Triangle Star Pattern") 
i = rows
while(i >= 1):
    for j in range(1, i + 1):      
        print('*', end = '  ')
    i = i - 1
    print()
Output

Enter the total Number of Rows: 5

Inverted Right Triangle Star Pattern

*  *  *  *  *  

*  *  *  *  

*  *  *  

*  *  

Program 2: Python Program to Print the Inverted Right Triangle Star Pattern Using While Loop

Python Program to Print the Inverted Right Triangle Star Pattern Using While Loop
# Python Program to Print the Inverted Right Triangle
# Star Pattern Using While Loop

# Take the Input from the User 
rows = int(input("Enter the total Number of Rows: "))

# Print the Output
print("Inverted Right Triangle Star Pattern")

i = rows
while(i >= 1):
    j = 1
    while(j <= i):      
        print('*', end = '  ')
        j = j + 1
    i = i - 1
    print()
Output

Enter the total Number of Rows: 6

Inverted Right Triangle Star Pattern

*  *  *  *  *  *  

*  *  *  *  *  

*  *  *  *  

*  *  *  

*  *  

*  


Related Posts



Comments

Recent Posts
Tags