πŸš€ Blog 2: Days 8–15 – Python OOP, File Handling & Exception Mastery

Daxa SondarvaDaxa Sondarva
2 min read

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. vs ClassName. 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 errors

  • Handled 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! πŸ’ͺ

0
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! 🌱