Python Program to Print Hollow Mirrored Rhombus Star Pattern

Write a Python Program to Print Hollow Mirrored Rhombus Star Pattern using for loop. This Python example uses nested for loops and if-else to return hollow mirrored rhombus pattern.

# Python Program to Print Hollow Mirrored Rhombus Star Pattern
 
rows = int(input("Enter Hollow  Mirrored Rhombus Pattern Rows = "))

print("Hollow Mirrored Rhombus Star Pattern") 

for i in range(0, rows):
    for j in range(0, i):
        print(' ', end = '')
    for k in range(0, rows):
        if(i == 0 or  i == rows - 1 or k == 0 or k == rows - 1):
            print('*', end = '')
        else:
           print(' ', end = '') 
    print()
Python Program to Print Hollow Mirrored Rhombus Star Pattern 1

This Python Program uses a while loop to print the Hollow Mirrored Rhombus Star Pattern.

# Python Program to Print Hollow Mirrored Rhombus Star Pattern
 
rows = int(input("Enter Hollow  Mirrored Rhombus Pattern Rows = "))

print("Hollow Mirrored Rhombus Star Pattern") 
i = 0
while(i < rows):
    j = 0
    while(j <= i):
        print(' ', end = '')
        j = j + 1
    k = 0
    while(k < rows):
        if(i == 0 or  i == rows - 1 or k == 0 or k == rows - 1):
            print('*', end = '')
        else:
           print(' ', end = '')
        k = k + 1
    i = i + 1
    print()
Enter Hollow  Mirrored Rhombus Pattern Rows = 15
Hollow Mirrored Rhombus Star Pattern
 ***************
  *             *
   *             *
    *             *
     *             *
      *             *
       *             *
        *             *
         *             *
          *             *
           *             *
            *             *
             *             *
              *             *
               ***************
>>> 

In this Python example, we created a hollowMirroredRhombus function to print the Hollow Mirrored Rhombus Pattern. It replaces the star in a hollow Mirrored Rhombus Pattern with a given symbol.

# Python Program to Print Hollow Mirrored Rhombus Star Pattern

def hollowMirroredRhombus(rows, ch):
    for i in range(0, rows):
        for j in range(0, i):
            print(' ', end = '')
        for k in range(0, rows):
            if(i == 0 or  i == rows - 1 or k == 0 or k == rows - 1):
                print('%c' %ch, end = '')
            else:
               print(' ', end = '') 
        print()
    
rows = int(input("Enter Hollow Mirrored Rhombus Pattern Rows = "))

ch = input("Symbol to use in Hollow Mirrored Rhombus Pattern = " )

print("Hollow Mirrored Rhombus Star Pattern") 

hollowMirroredRhombus(rows, ch)
Enter Hollow Mirrored Rhombus Pattern Rows = 18
Symbol to use in Hollow Mirrored Rhombus Pattern = $
Hollow Mirrored Rhombus Star Pattern
$$$$$$$$$$$$$$$$$$
 $                $
  $                $
   $                $
    $                $
     $                $
      $                $
       $                $
        $                $
         $                $
          $                $
           $                $
            $                $
             $                $
              $                $
               $                $
                $                $
                 $$$$$$$$$$$$$$$$$$
>>>