smallest program to make diamond python

Solutions on MaxInterview for smallest program to make diamond python by the best coders in the world

showing results for - "smallest program to make diamond python"
Suzanne
08 Jan 2020
1h = eval(input("please enter diamond's height:"))
2
3for i in range(h):
4    print(" "*(h-i), "*"*(i*2+1))
5for i in range(h-2, -1, -1):
6    print(" "*(h-i), "*"*(i*2+1))
7
8# please enter diamond's height:4
9#      *
10#     ***
11#    *****
12#   *******
13#    *****
14#     ***
15#      *
16#
17# 3, 2, 1, 0, 1, 2, 3  space
18# 1, 3, 5, 7, 5, 3, 1  star
19
20# please enter diamond's height:5
21#       *
22#      ***
23#     *****
24#    *******
25#   *********
26#    *******
27#     *****
28#      ***
29#       *
30#
31# 4, 3, 2, 1, 0, 1, 2, 3, 4  space
32# 1, 3, 5, 7, 9, 7, 5, 3, 1  star
queries leading to this page
write a python function print alphabets in diamond shapepython print pattern diamonuse for loops to print a diamond like the one below allow the user to specify how high the diamond should be in pytondoaimond shape pattern in c with 2 loopsdiamond shape pattern in python python function to print diamond shaped character pattern shown below function must take integer input within range 1 to 26 2c which represents the rank of alphabetdiamonds along with charatcer pattern in pythondiamond pattern in pythoninteger diamond pattern in pythonwrite a program to print the diamond shape pythonhow to make a diamond shape in pythonc 2b 2b print diamond with dotspython number diamond programdiamond star pattern in pythonprinting a diamond in pythondiamond pattern programs in pythonprinting dtars in diamond shapediamond pattern code in pythonall diamond star programs cpppython diamond patternpython program to print diamond patterncpp print diamondpython function to print diamond shaped character pattern python code for diamond of starsprint diamond pattern in pythondiamond pattern pythonwrite a program to print a solid diamond pattern of 2n 1 rowspython program for diamond patternwrite a program to print diamond pattern in pythonhow to print all diamond shapes using while loopdiamond star programme cppprogram to print diamond pattern in pythonpython star character like diamond python function to print diamond shaped 22 2a 22patternmake na diamond pythonprint sides of diamond pattern in pythongiven an integer n 2c print the corresponding diamond pattern with 2 2a n rows for example if n 3d 5 then pattern will be like 3a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2awrite a program to print the diamond shape python nested loopsolid diamond pattern in pythonprinting stars in diamond shapehow to print all diamond shapes using while loopdiamoonad pattern pythonwrite a program to print diamond pattern in python using 5c 2fpython function to print diamond shaped character pattern shown below function must take integer input within range 1 to 26 2c which represents the rank of alphabetsmallest program to make diamond python