Making a Box 2.0!

Published by Rahul Choubey in

This is based on Helen Yu's Making a Box challenge. This challenge is the same execpt that instead of a list of strings, your function should output a matrix of characters.

Examples

char_box(1) ➞ [
  ["#"]
]

char_box(4) ➞ [
  ["#", "#", "#", "#"],
  ["#", " ", " ", "#"],
  ["#", " ", " ", "#"],
  ["#", "#", "#", "#"]
]

char_box(2) ➞ [
  ["#", "#"],
  ["#", "#"]
]

Notes

As an added bonus, try making char_box(0) output [[]] and make any strings, non-integers, and negative numbers output -1.

Watch a quick demo on how Edabit works.