← Back to challenges

Something in the Box?

PythonHardsortingformattingvalidationloops

Instructions

Create a function that returns True if an asterisk * is inside a box.

Examples

in_box([
  "###",
  "#*#",
  "###"
]) ➞ True

in_box([
  "####",
  "#* #",
  "#  #",
  "####"
]) ➞ True

in_box([
  "*####",
  "# #",
  "#  #*",
  "####"
]) ➞ false

in_box([
  "#####",
  "#   #",
  "#   #",
  "#   #",
  "#####"
]) ➞ False

Notes

The asterisk may be in the array, however, it must be inside the box, if it exists.

python3
Loading editor…
⌘ ↵ to run
Walks through the solution with reasoning and edge cases.