Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python diamond print

h = eval(input("Enter diamond's height: "))
for x in range(h):
    print(" " * (h - x), "*" * (2*x + 1))
for x in range(h - 2, -1, -1):
    print(" " * (h - x), "*" * (2*x + 1))
#OUTPUT
# Enter diamond's height: 4
#      *
#     ***
#    *****
#   *******
#    *****
#     ***
#      *
Comment

PREVIOUS NEXT
Code Example
Python :: python iterate dictionary key value 
Python :: multiple variable input in python 
Python :: utf8 python encodage line 
Python :: python pil invert image color 
Python :: get role from name discord.py 
Python :: blender python set object location 
Python :: bmi python 
Python :: pandas read csv with index 
Python :: how to add list item to text file python 
Python :: csv to numpy array 
Python :: transpose a matrix using list comprehension 
Python :: how to scroll by in selenium python 
Python :: difference python list and numpy array 
Python :: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly 
Python :: bgr to gray opencv 
Python :: python server http one line 
Python :: how to set chrome options python selenium for a folder 
Python :: python check operating system 
Python :: converting string array to int array python 
Python :: python cd to script directory 
Python :: mysql config not found 
Python :: cv2 hconcat 
Python :: plt plot circle 
Python :: install os python 
Python :: tqdm notebook 
Python :: pandas remove index column when saving to csv 
Python :: image delete in django from the folder 
Python :: python day number from date 
Python :: trigonometry in python 
Python :: python get list of files in path 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =