Answer to Question #348847 in Python for Naveen

Question #348847

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 * * * * * * * * * * * *


1
Expert's answer
2022-06-08T14:27:17-0400

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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS