Answer to Question #230535 in Python for kaavya

Question #230535

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-29T00:57:42-0400
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("|/")

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