6 Program to Print Diamond Pattern in Python

Required Output:

Diamond Pattern in Python

Program:

star = int(input("Enter any number:"))

space = star // 2



for i in range(1,star+1,2):

    for j in range(0,space):

        print(" ",end="")

    space = space -1



    while(i>0):

        print("*",end="")

        i=i-1

    print()



star = star - 2

space = 1



for i in range(star,0,-2):

    for j in range(0,space):

        print(" ",end="")

    space = space + 1



    while(i>0):

        print("*",end="")

        i=i-1

    print()

Previous
Next Post »