Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

diamond shape in python

def p(n):
    for i in range(n):
        print(" "*(n-i-1),end="")
        print("* "*(i+1))
        
    for j in range(n-1, 0, -1):
        print(" "*(n-j),end="")
        print("* "*(j))

star_num = int(input("Enter a number that shows diameters of your diamond shape: "))
print(p(star_num))
 
PREVIOUS NEXT
Tagged: #diamond #shape #python
ADD COMMENT
Topic
Name
5+7 =