Module 10
Objects and classes
class, self, methods, operators
When you finish this module you can say:
I can write my own classes and teach them operators.
By the end of this module you'll be able to write a number class that can be added, multiplied, and prints itself readably. In Module 15 we'll add the ability to learn to this very same class.
StartLessons
8 lessons · ≈ 77 min
- Why a class?9 min
- class, __init__, and self10 min
- Methods9 min
- __repr__: printing an object readably8 min
- Inheritance and super()10 min
- Teaching operators to your own class10 min
- len, indexing, and looping9 min
- Project: the Value class12 min · project
Practice exercises
Short writing exercises, independent of the lessons: Go to the exercises