Answer to Question #218778 in Python for bala

Question #218778

Hollow Rectangle - 2

Write a program to print a rectangle pattern of

M rows and N columns using the characters as shown below.Input

The first line of input is an integer

M. The second line of input is an integer N.Explanation

In the given example,

3 rows and 10 columns.Therefore, the output should be


+----------+

| |

| |

| |

+----------+


Sample Input 1

3

10

Sample Output 1

+----------+

| |

| |

| |

+----------+

Sample Input 2

5

10

Sample Output 2

+----------+

| |

| |

| |

| |

| |

+----------+




1
Expert's answer
2021-07-19T10:14:51-0400
M = int(input())
N = int(input())
print("+"+N*"-"+"+")
for row in range(M):
    print("|"+N*" "+"|")
print("+"+N*"-"+"+")






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