Classmethod vs Staticmethod in Python’s OOP class Area: #defining an area classdef init(self,wt,ht):self.ht= htself.wt= wtdef area(self): #defining a simple rect area methodreturn self.wt*self.ht @classmethod def sqr(cls,sd): #defining a square method to take advantage of the rect area method return cls(sd,sd) Enter fullscreen mode Exit fullscreen mode class Tri(Area): #defining a triangle class to inherit from…

Read More