9. OOP#
Learning Goals
By the end of this chapter, you will be able to:
Understand what object-oriented programming (OOP) is and why it exists
Distinguish between a class and an instance
Create a simple class with attributes and methods
Recognize that everyday Python objects are instances of classes
Work with classes and methods, including understanding
__init__,__str__, and operator overloading
Overview
Object-Oriented Programming is an essential paradigm for writing larger, more complex programs. This chapter introduces you to the core concepts and patterns you’ll use throughout your programming career.
We’ll start with foundational ideas (what is a class? what is an object?), work through practical examples, and build up to more advanced OOP techniques. The approach emphasizes learning by doing: each concept is introduced with concrete examples you can run and modify.