Question #218513

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.


Expert's answer

M = int(input())
N = int(input())


horizontal_border = f'+{"-" * N}+'
line = f'|{" " * N}|'


output = horizontal_border
for row in range(M):
    output += f'\n{line}'
output += f'\n{horizontal_border}'
print(output)

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!

LATEST TUTORIALS
APPROVED BY CLIENTS