Day to Day Change
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
1 <= len(prices) <= 100
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Diagonal From ValuesBeginner
- Evenly SpacedBeginner
- Every Other SumBeginner
- Hottest DayBeginner
- Lower Triangle TotalBeginner
- Median ScoreBeginner
- Multiples Up ToBeginner
- Overlap CountBeginner