Classes · Lesson 43 of 76
Your first class
So far values like numbers and strings have been separate. A class lets you bundle related data (and the actions on it) into one tidy thing you design yourself. Think of a class as a blueprint, and the things you make from it as objects.
Python
__init__ runs when you create an object and sets up its data. self is how each object refers to itself. Don't worry if it feels new — the next lessons slow it right down.
Your turn: create a third student with your own name and track, and print it.
You’re reading for free. Sign in to keep your progress and earn a certificate when you finish.Sign in to keep my progress →