Hallow Inverted Full Pyramid - 1
Given the number of rows N, write a program to print the hallow inverted full pyramid pattern similar to the pattern shown below. * * * * * * * * * * * *
Input The input will be a single line containing a positive integer (N).
Output The output should be N rows containing the asterisk(*) character in the hollow inverted full pyramid pattern. Note: There is a space after each asterisk(*) character.
Explanation For example, if the given number is 5, the pattern should contain 5 rows as shown below * * * * * * * * * * * * Sample Input 1 5 Sample Output 1 * * * * * * * * * * * *
Solution "Hallow Inverted Full Pyramid - 1"
repeater
def repeater(re_num,sym):
i=0
result=""
while i<re_num:
result=result+sym
i=i+1
return(result)
num=int(input("Please enter an integer number: \n"))
i=0
while i<num:
print(repeater(2*i," ")+repeater(num-i+(num-1-i),"* "))
i=i+1
Comments
Leave a comment