Chapter 1 of 10: Before the lecture
Builds a Workout class step by step, then a Run subclass that overrides calorie estimation using GPS coordinates.
Object-oriented programming in Python takes shape through a fitness tracker designed one class at a time, in session 19 of MIT's introductory course. Bell starts with a Workout class holding start time, end time and calories behind getter methods. She then adds class variables and estimates calories from elapsed seconds computed with datetime objects. A Run subclass inherits from Workout, reuses the parent's string method through super, and overrides calorie estimation with latitude and longitude tuples. Later segments cover subtype polymorphism, the Liskov substitution principle and an equality dunder method. Basic Python and earlier lectures on classes and instances are assumed, and the session closes with a warning against over-engineering.
Object-oriented programming in Python takes shape through a fitness tracker designed one class at a time, in session 19 of MIT's introductory course. Bell starts with a Workout class holding start time, end time and calories behind getter methods. She then adds class variables and estimates calories from elapsed seconds computed with datetime objects. A Run subclass inherits from Workout, reuses the parent's string method through super, and overrides calorie estimation with latitude and longitude tuples. Later segments cover subtype polymorphism, the Liskov substitution principle and an equality dunder method. Basic Python and earlier lectures on classes and instances are assumed, and the session closes with a warning against over-engineering.

This lecture
Lecture 19 of 25 of Introduction to Computer Science and Programming using Python.
Choose a node to see how it connects to this lecture. What comes before is on the leftat the top. What comes after is on the rightat the bottom. The ring is what it teaches. People and places are above.
Press a chosen node again to open it.
Your comment is kept while you sign up.Sign in