Concepts·Certified Associate Python Programmer
Python Classes and Objects
PCAP objective 4.1 is understand the object-oriented approach, and it is the start of the 34% of that exam PCEP never mentions. A class is a template; an instance is a thing made from it. Both are objects, both have a `__dict__`, and attributes can be added to an instance from outside the class entirely - which is unusual, and which several later questions depend on.
Object-Oriented Python Guide 12 of 25 Intermediate
- Python3.14.4
- OSUbuntu 26.04 LTS
- pip25.1.1
- TimeAbout 16 min
- Reviewed23 August 2026
Written against the versions above. Every class in Python 3 is a new-style class inheriting from `object`, whether you say so or not - `class Dog:` and `class Dog(object):` are identical. Older material that distinguishes them is describing Python 2.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| RUNNER01 | 192.168.0.27 | Ubuntu 26.04 LTS | Python 3.14.4 - the only machine this path needs | 2 Core | 4 GB | 50 GB |
Before you start
-
The smallest class
-
Attributes can be added from outside
-
Asking for an attribute that is not there
-
What an object prints as by default
-
__str__ and __repr__
-
A class with data and behaviour
-
What the exam does with this objective