Shape Area is a simple math package that calculates the area of a shape.
- Simplifies adding new shapes by using abstractions, inheritance and polymorphism.
- Allows changing of shape parameters on-the-go.
- Uses UV package manager
git clone https://github.com/monk-coder/shape-areas.git
cd shape-areas
uv venv .venv
uv sync
from shape_area import Circle, Triangle, RightTriangle
circle = Circle(100)
triangle = Triangle(10, 15, 20)
right_triangle = RightTriangle(6, 8, 10)
print(
f"Area of the circle: {circle.area:.2f}\n"
f"Area of the triangle: {triangle.area:.2f}\n"
f"Area of the right triangle: {right_triangle.area:.2f}"
)
circle.radius = 10
triangle.sides = (2, 3, 4)
right_triangle.sides = (3, 4, 5)
print(
f"New area of the circle: {circle.area:.2f}\n"
f"New area of the triangle: {triangle.area:.2f}\n"
f"New area of the right triangle: {right_triangle.area:.2f}"
)