Write a program to print a pyramid of N rows
+ + + + * + + + +
+ + + * * * + + +
+ + * * * * * + +
n=int(input('Number Rows Pyramid: '))
for i in range(n):
l=(n*n)//2-i
r=(n*n)//2+i
s=''
for j in range(n*n):
if j>=l and j<=r:
s+='*'
else:
s+='+'
print(s)
Comments
Leave a comment