Basic Programs

If Else Programs

While loop Programs

For loop Programs

List Programs


Python Program to Print a Diamond Star Pattern using For Loop


This example shows, how to print diamond star Pattern.

Example.py
a = int(input("Enter the Diamond rows: "))

for i in range(a):
    print(" " * (a - i), "*" * (2*i + 1))
for i in range(a - 2, -1, -1):
    print(" " * (a - i), "*" * (2*i + 1))

Output

Enter the Diamond rows: 10


           *
          ***
         *****
        *******
       *********
      ***********
     *************
    ***************
   *****************
  *******************
   *****************
    ***************
     *************
      ***********
       *********
        *******
         *****
          ***
           *

Prev Next