Problem 100411 · easy · Phase 01 Prerequisites & Setup

Hollow Box

nested loops · strings · conditionals

Draw a hollow rectangle that is width characters wide and height rows tall. Return a list of height strings. Cells on the outer border are #; every other cell is a space.

Examples

Input:  width = 4, height = 3
Output: ["####", "#  #", "####"]

Input:  width = 5, height = 1
Output: ["#####"]

Constraints

  • 1 <= width, height <= 40

Goals

  • Tell border cells apart from interior cells using indices
  • Handle thin boxes where every cell is on the border
Starting Python…