Answer to Question #227746 in Python for saras

Question #227746

_Given an integer number

N as input. Write a program to print the right-angled triangular pattern of N rows as shown below.Input

The first line of input is a positive integer.

Explanation

For example, if the given number is

5, the output should be

______

|  /

|  /

| /

| /

|/


1
Expert's answer
2021-08-19T14:31:29-0400
n = int(input('Please enter a positive integer: '))
for i in range(n):
    print("_", end='')




print()
for i in range(n+1):
    for j in range(n-i):
        if(j == 0):
            print("|",end='')
        if(j == n-i-1):
            print("/", end='')
        else:
            print(" ", 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