FunctionRacerProblemsRace

Change Between Rows

EasyNumPyPython

Each row of grid is a snapshot of several sensors taken at one moment. Return a 2-D array that shows, for each pair of neighboring rows, the second row minus the first row. It has one fewer row than grid. Hint: np.diff with axis=0.

Example 1

grid [[1,5],[4,5],[2,9]]
returns [[3,0],[-2,4]]

Row 1 minus row 0 is [3, 0]; row 2 minus row 1 is [-2, 4].

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More NumPy problems