Python Online Compiler
Example: Print Rhombus Pattern in Python language of Stars
C
C++
C#
Java
Python
PHP
main.py
STDIN
Run
# 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)
7
Output
Clear
ADVERTISEMENTS