Hollow Rectangle - 2
Write a program to print a rectangle pattern of M rows and N columns using the characters as shown below.
The first line of input is an integer M. The second line of input is an integer N.
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
+----------+
| |
| |
| |
| |
| |
+----------+
M = int(input('Enter no of rows here: '))
N = int(input('Enter no of columns here: '))
for i in range(M+2):
if i == 0:
print('+'+(N * '-')+'+')
elif i == M+1:
print('+'+(N * '-')+'+')
else:
print('|'+ '' + '|' )
Enter no of rows here: 3
Enter no of columns here: 10
+----------+
||
||
||
+----------+
Comments
Leave a comment