π Blog 2: Days 8β15 β Python OOP, File Handling & Exception Mastery


After building strong Python basics in the first 7 days, I dove deeper into Object-Oriented Programming (OOP), File Handling, and Error Handling from Day 8 to Day 15 of my #100DaysOfCode journey.
This part of my journey introduced me to writing real-world code structures like classes, reading/writing data to files, and handling errors like a pro.
β What I Learned from Day 8 to 15:
πΈ Object-Oriented Programming (OOP) in Python
Class & Objects β Defined custom blueprints and created objects.
init() Constructor β Initialized values when creating objects.
Self Keyword β Referred to current instance of class.
Instance vs Class Variables β Used
self.
vsClassName.
to differentiate.Methods β Functions defined inside class.
Inheritance β Reused parent class features in child classes.
Encapsulation β Controlled access using public, protected
_var
, private__var
.Polymorphism β Created methods with same name but different behaviors.
Abstraction β Used abstract base class and
@abstractmethod
to enforce method presence.
π Mini Project: Bank Account System with deposit, withdraw, and balance using classes.
πΈ File Handling in Python
Opened files using
open()
Read files:
.read()
,.readline()
,.readlines()
Wrote content using
.write()
and.writelines()
Used
with open()
for safe handling (auto close)Appended data without overwriting
Managed text files, CSV files (with csv module), Excel files (with openpyxl), and JSON data (with json module)
π Practice: Created & read CSV with student data, wrote JSON file from a dictionary
πΈ Exception Handling in Python
Used
try
,except
blocks to catch errorsHandled specific errors like
ZeroDivisionError
,ValueError
,FileNotFoundError
Used
finally
to always run code (cleanup)Raised custom errors using
raise
Defined custom exceptions using class inheritance (e.g.
class MyError(Exception)
)
π Mini Program: Built a division calculator with error catching + custom exception if dividing by 0
πββοΈ Letβs Connect!
π Connect with me on LinkedIn
π Explore my GitHub Projects
πThese 8 days were a big step from simple scripts to more real-world and structured programming. I now understand how Python is used in building systems, managing data, and writing clean, safe code.
Sharing to stay consistent and grow publicly β thanks for reading! πͺ
Subscribe to my newsletter
Read articles from Daxa Sondarva directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Daxa Sondarva
Daxa Sondarva
Python Learner | #100DaysOfCode π Sharing my learning journey through code, blogs, and handwritten notes βοΈ Aspiring Python Developer | Exploring Data & Logic π» Let's learn in public and grow together! π±