Answer to Question #349767 in Python for Vvv

Question #349767

Hollow pattern using / and _ and | right angle triangle

1
Expert's answer
2022-06-10T18:33:17-0400

Answer to the question

def repiter(re_num,sym):
    i=0
    result=""
    while i<re_num:
        result=result+sym
        i=i+1
    return(result)

num=int(input("Height of a right triangle. Please enter an integer: \n"))
num=num-1
i=0
while i<num:
    print(repiter(num-i," ")+"/"+repiter(i," ")+"|")
    i=i+1
else:
    sym=repiter(i,"_")
    print("/"+sym+"|")

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