10 min read Intermediate Lesson 10 of 11
Part 4 — Systems & Projects

OOP Basics: Classes & Objects

Object-Oriented Programming (OOP) packages state (variables) and behavior (functions) into custom cohesive types called Classes.

The Blueprint & The Instance

class BankAccount:
def __init__(self, owner: str, initial_balance: float = 0.0):
self.owner = owner
self.balance = initial_balance
def deposit(self, amount: float):
if amount > 0:
self.balance += amount
return self.balance

The class is the architectural blueprint. Each time you call account = BankAccount("Alice", 500), Python instantiates a brand new isolated object in RAM.

Quick Summary

  • Classes bundle data attributes and methods together into coherent entities.
  • Next, we combine everything into an end-to-end Capstone Project.