This week, I took a deeper dive into some of PythonāsĀ most powerful building blocks:Ā methods, classes, arrays, and lists. It was both exciting and a bit brain-bending, but Iām finally starting to see how these tools come together to make Python such a flexible and efficient language.
š§± Classes & Objects: Building Your Own Structures
At first, classes felt abstract. I wasnāt sure why Iād use them when functions seemed to get the job done. But once I actually created my own class and instantiated objects from it, I realized:Ā classes are like templates for real-world things.
Hereās a simple example I practiced with:

ā I now understand how to:
⢠Use __init__ to set object properties
⢠Define methods to perform actions inside the class
⢠Create multiple instances of the same class with different data
Ā OOP makes codeĀ more reusable and organized. I used to write separate functions for every variation of a problemānow I just create objects!
š§° Methods: Actions That Belong to Objects
UnderstandingĀ methodsĀ (especially how they differ from regular functions) helped me think more like a software developer. A method is basicallyĀ a function that ābelongsā to a class.
I practiced creating methods to:
⢠Calculate values (calculate_tax())
⢠Update attributes (like adjusting the bill)
⢠Print or return data in a formatted way
Ā Methods help keep data and logicĀ encapsulated. Itās clean, efficient, and avoids unnecessary repetition.
š Lists: The Swiss Army Knife of Python
Python lists are incredibly versatile. I used them to store groups of numbers, strings, and even objects I created from classes.
Example:

I also practiced:
⢠Looping through lists with for loops
⢠Adding/removing items with .append() and .remove()
⢠Using list comprehensions to simplify code
Lists are essential for managingĀ collections of data. Learning list comprehension was a game-changerāit made my code cleaner and faster.
š¢ Arrays: A More Specialized Tool
While lists are flexible, I learned thatĀ arraysĀ (from theĀ arrayĀ module or libraries like NumPy) are more efficient for large amounts of numerical data.

I now understand the difference:
⢠Lists = general-purpose, can store anything
ā¢Ā Arrays =Ā faster and more memory-efficient, but only for numbers of a single type
š Bringing It All Together: Small Project Idea
TheĀ Student Grade Management System
š§ Hereās what the system will be able to do:
1. ā Add a new student
2. š Add grades to a student
3. š Calculate a studentās average
4. š Show top student(s)
5. š Search for a student by name or ID
6. š¾ Save and load data from a file
7. šļø Optional: Delete a student