Hollow Right Triangle
Given an integer number
The first line of input is an integer
In the given example the hollow right angled triangle of side
4. Therefore, the output should be
* * * *
* *
* *
*
rows = int(input('Enter no of rows here: '))
for i in range(1,rows+1):
if i == 1:
print('* '*rows)
elif i != 1 and i != rows:
print(' '*(2*(i-1))+'*'+' '*(2*(rows-i-1)+1) + '*')
else:
print(' ' * (2*rows-2)+'*')
Enter no of rows here: 4
* * * *
* *
* *
*
Comments
Leave a comment