How can three different spellings of the same date all parse into one subtractable object, and which dictionary does `cal_per_hr` live in?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
The two datetime objects start_date (September 30, 2021 at 1:35 PM) and end_date (1:45 PM the same afternoon) are already built for you — exactly what parser.parse hands back. Work out how long that stretch of time is and assign the result to gap.
from datetime import datetime # parser.parse would hand back exactly these two objects start_date = datetime(2021, 9, 30, 13, 35) end_date = datetime(2021, 9, 30, 13, 45)
Three spellings of one date, parsed and subtracted
Parse '9/30/2021 1:35 PM', 'Sept 30 2021 1:35 PM' and 'September, 30, 2021 1:45pm', then write the printed datetime.datetime value, the 0:10:00 timedelta and the 600.0 from .total_seconds().
The class dictionary gaining exactly one entry
Write the keys of Workout.__dict__ with cal_per_hr sitting among the methods, the unchanged instance keys ['start', 'end', 'icon', 'kind', 'calories'], and the rule about which dictionary a class variable occupies.
Reaching a class variable from outside the class
Record that Workout.cal_per_hr, w.cal_per_hr and the assignment Workout.cal_per_hr = 250 are all allowed, that every later access reports 250, and the style rule against all three.
Two workouts, one estimated and one supplied
Build w_one = Workout('1/1/2021 3:30 PM', '1/1/2021 4:00 PM') and w_two = Workout('1/1/2021 3:35 PM', '1/1/2021 4:00 PM', 300), then write the two printed calorie values, 100 and 300.