Answer to Question #339455 in Python for chaitu

Question #339455

The output should be N lines containing the triangle pattern. Explanation For example,if the given number is 5,the pattern should be printed in 5 lines,as shown below



1
Expert's answer
2022-05-10T16:00:44-0400
n = int(input())
for i in range(n):
    print((n - i) * ' ' + '/', end='')
    if i < n - 1:
        print(' ' * i, end='')
    else:
        print('_' * i, end='')
    print('|')

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