Print Rhombus Pattern in Python language of Stars
ADVERTISEMENTS
Print rhombus pattern in python language of stars. In this article, you will learn how to print rhombus pattern in python language of stars using the for loop.
Source Code
# Print Rhombus Pattern in Python language of Stars
def rhombusPattern(x):
i, j = 0, 0
for i in range (1, x + 1):
# print the spaces
for j in range (i, x):
print (end=" ")
# print the stars
for j in range (1, x + 1):
print (end="*")
print (end="\n")
print ("-----Enter the total number of rows-----")
x = int (input ())
# x - the number of rows
if x > 0:
# calling function to print the pattern
rhombusPattern(x)
Output
------Enter the total number of rows-----
7
*******
*******
*******
*******
*******
*******
*******