What is an Interface ?
                  An interface is a blueprint that defines what methods a class must implement, without providing their implementation.

Do Interfaces Exist in Python?

Python does not have a built-in interface keyword like Java.

However, Python implements interfaces using:

  • Abstract Base Classes (ABC)

  • Abstract methods


Why Interfaces are Needed ?

  • enforce method implementation
  • achieve loose coupling
  • support multiple inheritance
  • build scalable applications
  • define contracts between classes

Example :

Python
from abc import ABC, abstractmethod class Vehicle(ABC): @abstractmethod def start(self): pass class Car(Vehicle): def start(self): print("Car started") class Bike(Vehicle): def start(self): print("Bike started") c = Car() b = Bike() c.start() b.start() #output Car started Bike started 


Interface vs Abstract Class :

InterfaceAbstract Class
Only abstract methodsAbstract + concrete methods
No implementationPartial implementation
Used for contractsUsed for base logic
Multiple inheritanceLimited inheritance