Answer to Question #222924 in Python for srikanth

Question #222924
Right Angled Triangle - 3

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

______
|    /
|   /
|  /
| /
|/
Sample Input 1
5
Sample Output 1
______
|    /
|   /
|  /
| /
|/
Sample Input 2
7
Sample Output 2
________
|      /
|     /
|    /
|   /
|  /
| /
|/

1
Expert's answer
2021-08-04T07:35:14-0400
N = int(input())
for i in range(N+1):
    print('_', end='')
print()
for i in range(N):
    print('|', end='')
    print(' ' * (N - i - 1), 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