FunctionRacerProblemsRace

Day to Day Change

BeginnerNumPyPython

Return a list of how much the price changed from each day to the next (next minus current). The result has one fewer item than prices; for a single price it is an empty list. Hint: np.diff.

Example 1

prices [10,12,9,9]
returns [2,-3,0]

12 - 10, 9 - 12, 9 - 9.

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