Classes and Instances

Scenario: A monitoring program passes several related service values through every function.

New words, in plain English

Classes group state and behavior when those belong together. Creating an instance calls the class. self is the current instance and is passed automatically to instance methods.

Analogy: A Python program is like a clear set of instructions for a careful helper: names label things, indentation groups steps, and errors explain where the helper became confused.

A small, real example

class Service:
    def healthy(self):
        return self.status == "up"

api = Service()
api.status = "up"
print(api.healthy())
Tip: Use a class when behavior protects or explains related state, not merely to wrap one dict.
Goal: Practice this idea in the py-small-class challenge at /labs/python. Fix the broken program, run it yourself, then use check to prove the real end state.