In the example below; "Polygon" class is the base class which has the abstract method. "Triangle" is the derived class which overrides the abstract method. All required syntax can be found below:
from abc import ABC, abstractmethod
# Defining an abstract class
class Polygon(ABC):
@abstractmethod
def noofsides(self):
pass
# Define Trinangle class, from the abstract Polygon class
class Triangle(Polygon):
# overriding abstract method
def noofsides(self):
print("I have 3 sides")