Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

printing hollow triangle in python


# Generating Hollow Pyramid Pattern Using Stars

row = int(input('Enter number of rows required: '))

for i in range(row):
    for j in range(row-i):
        print(' ', end='') # printing space required and staying in same line
    
    for j in range(2*i+1):
        if j==0 or j==2*i or i==row-1:
            print('*',end='')
        else:
            print(' ', end='')
    print() # printing new line
Comment

PREVIOUS NEXT
Code Example
Python :: replace space with _ in pandas 
Python :: pandas number of observations 
Python :: how to convert index to column in pandas 
Python :: python extraer primer elemento lista 
Python :: python json to dict and back 
Python :: open an exe file using python 
Python :: python temp directory 
Python :: django admin table columns wrap text into multiple lines django 
Python :: python twilio certificate error 
Python :: how to put more than one file type in pysimplegui 
Python :: wap to draw the shape of hexagonn in python 
Python :: datetime python 
Python :: list(set()) python remove order 
Python :: histogram seaborn 
Python :: np.sort descending 
Python :: how to activate virtual environment in python 
Python :: python catch all exceptions 
Python :: who is elcharitas 
Python :: pair plot python 
Python :: python get script path 
Python :: python accept user input 
Python :: dataframe groupby to dictionary 
Python :: python request post with json with headers 
Python :: divide a value by all values in a list 
Python :: python open dicom 
Python :: how to add column headers in pandas 
Python :: do you have to qualift for mosp twice? 
Python :: delete a record by id in flask sqlalchemy 
Python :: random permutation python 
Python :: how to print not equal to in python 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =