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.
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
________
| /
| /
| /
| /
| /
| /
|/
rows = int(input())
if rows < 0:
print("Rows can't be negative, please enter a correct number")
else:
tabs = rows + 1
print("_"*tabs)
last_number = rows
for row in range(rows-1):
print("| /")
print("|/")
Comments
Leave a comment