Describe the Tray

Data with PythonMedium+10 XP+10

Describe the Tray

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 isReturn
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.

Examples

values = [4, 8, 15]
returns 'a line of 3 values'
values = [[18, 21, 19], [25, 27, 26]]
returns '2 rows of 3 (6 values)'

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run