Answers for "smallest program to make diamond python"

0

smallest program to make diamond python

h = eval(input("please enter diamond's height:"))

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

# please enter diamond's height:4
#      *
#     ***
#    *****
#   *******
#    *****
#     ***
#      *
#
# 3, 2, 1, 0, 1, 2, 3  space
# 1, 3, 5, 7, 5, 3, 1  star

# please enter diamond's height:5
#       *
#      ***
#     *****
#    *******
#   *********
#    *******
#     *****
#      ***
#       *
#
# 4, 3, 2, 1, 0, 1, 2, 3, 4  space
# 1, 3, 5, 7, 9, 7, 5, 3, 1  star
Posted by: Guest on July-08-2020

Code answers related to "smallest program to make diamond python"

Python Answers by Framework

Browse Popular Code Answers by Language