Print an n level pyramid as follows where n is a positive integer taken as input. each triangle will be made out of “*” symbols and the spaces will be filled by "#" symbols for each row. for example, a 3 level pyramid will look as follows:
##*##
#***#
*****
Note: There should be no space between the stars. Remember to not print any extra character or spaces or else your solution could be rejected.
Sample input: 4
Sample output:
###*###
##***##
#*****#
*******
Python 3 level pyramid
n=int(input())
for i in range(n):
print('#'*(n-i-1) + '*'*(2*i+1)+'#'*(n-i-1))
Comments