Write a Python Program to Print Rhombus Pattern using a for loop. This Python example uses multiple for loops to print rhombus star patterns.
# Python Program to Print Rhombus Star Pattern rows = int(input("Enter Rhombus Star Pattern Rows = ")) print("Rhombus Star Pattern") for i in range(rows, 0, -1): for j in range(1, i): print(' ', end = '') for k in range(0, rows): print('*', end = '') print()
Python Program to Print Rhombus Star Pattern using a while loop.
# Python Program to Print Rhombus Star Pattern rows = int(input("Enter Rhombus Star Pattern Rows = ")) print("Rhombus Star Pattern") i = rows while(i >= 1): j = 1 while(j <= i - 1): print(' ', end = '') j = j + 1 k = 0 while(k < rows): print('*', end = '') k = k + 1 i = i - 1 print()
Enter Rhombus Star Pattern Rows = 20
Rhombus Star Pattern
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
********************
>>>
In this Python Program, the rhombusStar function accepts a symbol and prints the Rhombus Pattern of a given symbol.
# Python Program to Print Rhombus Star Pattern def rhombusStar(rows, ch): for i in range(rows, 0, -1): for j in range(1, i): print(' ', end = '') for k in range(0, rows): print('%c' %ch, end = '') print() rows = int(input("Enter Rhombus Star Pattern Rows = ")) ch = input("Symbol to use in Half Diamond Pattern = " ) print("Rhombus Star Pattern") rhombusStar(rows, ch)
Enter Rhombus Star Pattern Rows = 14
Symbol to use in Half Diamond Pattern = #
Rhombus Star Pattern
##############
##############
##############
##############
##############
##############
##############
##############
##############
##############
##############
##############
##############
##############
>>>