A fitness app needs a step counter. The counting part is general, so it goes in a parent.
Counter (the parent):
Counter() takes no values. It sets count to 0.add(amount) adds amount to count.reset() sets count back to 0.StepCounter (a child of Counter, with no __init__ of its own):
distance_km() returns count * 0.0008, rounded to 2 decimal places. (One step is 0.8 metres.)Then write two functions:
walk_distance(walks): make a StepCounter, add each number of steps in the list, and return distance_km().steps_since_reset(before, after): make a StepCounter. Add every number in before, then call reset(), then add every number in after. Return count.