Hollow Inverted Full Pyramid - 2
Given the number of rows N, write a program to print the hallow inverted full pyramid pattern similar to the pattern shown below.
1 2 3 4 5
1 4
1 3
1 2
1
n = int(input())
s = ''
for el in range(1,n+1):
s += str(el) + ' '
s+= '\n'
for i in range(1, n-1):
s += ' '*i + '1 ' + ' '*(n-(2*i)+1) + f'{n-i}'
s += '\n'
s += ' '*(n-1) + '1'
print(s)
Comments
Leave a comment