Hollow rectangle in python assignment expert

Hollow Rectangle - 2

This Program name is Hollow Rectangle - 2. Write a Python program to Hollow Rectangle - 2

The below link contains Hollow Rectangle - 2 question, explanation and test cases

//drive.google.com/file/d/1nWuk5uhqVJKhOJbg9IaBoW8S8FUrNSbX/view?usp=sharing

We need exact output when the code was run

M = int[input[]]
N = int[input[]]
print["+"+N*"-"+"+"]
for _ in range[M]:
    print["|"+N*" "+"|"]
print["+"+N*"-"+"+"]

Learn more about our help with Assignments: Python

Answer to Question #218778 in Python for bala

Hollow Rectangle - 2

Write a program to print a rectangle pattern of

The first line of input is an integer

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[]]
N = int[input[]]
print["+"+N*"-"+"+"]
for row in range[M]:
    print["|"+N*" "+"|"]
print["+"+N*"-"+"+"]

Learn more about our help with Assignments: Python

View Discussion

Improve Article

Save Article

  • Read
  • Discuss
  • View Discussion

    Improve Article

    Save Article

    Hollow rectangle star pattern :

    The task is print below hollow pattern of given dimension. 
     

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************

    Explanation: 
     

    • Input number of rows and columns.
    • For rows of rectangle run the outer loop from 1 to rows. 
       
    for [i = 1; i < = rows; i++]
    • For column of rectangle run the inner loop from 1 to columns. 
       
    for [j = 1; j < = columns; j++]
    • Print star for first or last row or for first or last column, otherwise print blank space.
    • After printing all columns of a row, print new line after inner loop.

    C++

    #include

    using namespace std;

    void print_rectangle[int n, int m]

    {

        int i, j;

        for [i = 1; i

    Javascript

          function print_rectangle[n, m]

          {

            var i, j;

            for [i = 1; i

    Javascript

    Javascript   

        function print_square[int n]

        {

            var i, j;

            for [i = 1; i

    Chủ Đề