Constructors – OOP Python

“init” is a reserved method in python classes. It is called as a constructor in object oriented terminology.

This method is called when an object is created from a class and it allows the class to initialize the attributes of the class.

class Laptop:   
    # init method or constructor  
    def __init__(self, name): = name 
    # Sample Method  
    def brand(self): 
        print('Brand Name: ', 
obj = Laptop('Dell') #object creation