What exactly does the single line `super().__init__(start, end, calories)` do before `RunWorkout` overrides the icon and adds elevation?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
The Workout class from the earlier videos is given above. Give it a subclass for running that has no body of its own yet, then build one from the two time strings '8:00' and '8:45' — the parent's constructor is already there to do it. Define the class RunWorkout and assign the object you build to run.
# The Workout parent class from the earlier videos of this unit,
# with the times kept as plain strings and the icons as plain words.
class Workout(object):
cal_per_hr = 200
def __init__(self, start, end, calories=None):
self.start = start
self.end = end
self.calories = calories
self.icon = 'sweat'
self.kind = 'Workout'
def get_calories(self):
return self.calories
def get_kind(self):
return self.kind