;

Python Program to Print the Reverse Mirrored Right Angled Triangle Star Pattern


Tutorialsrack 16/05/2020 Python

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

Here is the Source code of the program to print the reverse mirrored right-angled triangle star pattern.

Program 1: Python Program to Print the Reverse Mirrored Right Angled Triangle Star Pattern Using For Loop

Python Program to Print the Reverse Mirrored Right Angled Triangle Star Pattern Using For Loop
# Python Program to Print the Reverse Mirrored Right Angled Triangle
# Star Pattern Using For Loop

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

# Print the Output
print("Reverse Mirrored Right Triangle Star Pattern") 
for i in range(1, rows + 1):
    for j in range(1, rows + 1):
        if(j < i):
            print(' ', end = '  ')
        else:
            print('*', end = '  ')
    print()
Output

Enter the Total Number of Rows: 5

Reverse Mirrored Right Triangle Star Pattern

*  *  *  *  *  

   *  *  *  *  

      *  *  *  

         *  *  

            *  

Program 2: Python Program to Print the Reverse Mirrored Right Angled Triangle Star Pattern Using While Loop

Python Program to Print the Reverse Mirrored Right Angled Triangle Star Pattern Using While Loop
# Python Program to Print the Reverse Mirrored Right Angled 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("Reverse Mirrored Right Triangle Star Pattern") 
i = 1
while(i <= rows):
    j = 1
    while(j <= rows):
        if(j < i):
            print(' ', end = '  ')
        else:
            print('*', end = '  ')
        j = j + 1
    i = i + 1
    print()
Output

Enter the Total Number of Rows: 6

Reverse Mirrored Right Triangle Star Pattern

*  *  *  *  *  *  

   *  *  *  *  *  

      *  *  *  *  

         *  *  *  

            *  *  

               * 


Related Posts



Comments

Recent Posts
Tags