I’ve recently been learning python and on this process I have encountered a something that caught my attention, Object Oriented Programming, this way of writing and structuring your code offers a new way of approaching a problem and that’s why today I’ll explain a few concepts related to it.

Let’s start imagining an object, could be whatever object you want, for example, I’m gonna choose a bike, so in this example, my bike would have some properties, for example, the brand, the color, the length, the height, etc. As my bike, any other bike could have its own brand, color, length, etc. So this properties that both bikes share could be defined in a class for this example would be the “Bike” class, and each bike would be an instance of this class, what we call objects, as we can see each object can have different values for the properties it has, so this is a pretty simplified example of what a class and object means, just to warm up!!!, hahaha.

Now let’s see how this can be translated to code using python, first let’s define our class Bike and then let’s create two object with different properties

#python #oop #programming

Object Oriented Programming in Python
24.30 GEEK