kenken999's picture
test
275b9f3
raw
history blame
436 Bytes
from dataclasses import dataclass
@dataclass
class Shape:
"""Base class for shapes"""
def area(self):
raise NotImplementedError
@dataclass
class Circle(Shape):
"""Circle shape"""
radius: float
def area(self):
return 3.14 * self.radius ** 2
@dataclass
class Rectangle(Shape):
"""Rectangle shape"""
width: float
height: float
def area(self):
return self.width * self.height