Free practice topic

Python classes and objects

Learn Python classes with small AI-flavored objects: counters, retrievers, and simple tools. Run code in the free compiler.

What you will learn

  • +__init__ and self
  • +Methods that change state
  • +Tiny tool-style objects

Starter idea: Build a tiny Counter class with add() and a value.

Tiny example

Store a model name on self, then print it.

class Client:
    def __init__(self, model):
        self.model = model

print(Client("mini").model)