Day-to-Day Changes

Python for AIMedium+10 XP+10

Day-to-Day Changes

A list holds a temperature reading for each day, in order.

Write daily_changes(readings). It returns a list of how much each day changed from the day before it: today - yesterday.

  • The result is one shorter than readings, because the first day has nothing before it.
  • A list with 0 or 1 readings gives back an empty list.

Examples

readings = [10, 13, 11]
returns [3, -2]
readings = [5]
returns []

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