A packing app shows a short line of text under every tray of values, so a worker can see its layout at a glance.
Task: write describe_layout(values). values is either a plain list of numbers, or a list of rows where every row is the same length. Return a string:
| If the array is | Return |
|---|---|
a single line of n values | "a line of n values" |
a grid of r rows and c columns, s values in total | "r rows of c (s values)" |
Use the singular word when the count is exactly 1: "value" instead of "values", and "row" instead of "rows".
Watch out: a grid with a single row, like [[1, 2, 3]], is still a grid. It is not a line.
There is always at least one value.