| [ Web Proxy ] |
| Viewing: https://raw.githubusercontent.com/mlecjm/programmingWithPythonCode/main/classes/shape.py | [Back] [Original] |
"""A base class for shapes."""
class Shape:
"""A closed geometric shape has an area and a perimeter."""
def area(self) -> int | float:
"""
Get the area of this shape.
:return: the area of this shape
"""
raise NotImplementedError # must be implemented by subclasses
def perimeter(self) -> int | float:
"""
Get the perimeter of this shape.
:return: the perimeter of this shape
"""
raise NotImplementedError # must be implemented by subclasses
| Web Proxy Viewer | New URL | Original Page |