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): """Calculate the area of the circle""" return 3.14 * (self.radius ** 2) @dataclass class Rectangle(Shape): """Rectangle shape""" width: float height: float def area(self): """Calculate the area of the rectangle""" return self.width * self.height