Skip to content

monk-coder/shape-area

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shape Area

Shape Area is a simple math package that calculates the area of a shape.

Features

  • Simplifies adding new shapes by using abstractions, inheritance and polymorphism.
  • Allows changing of shape parameters on-the-go.
  • Uses UV package manager

Installation

git clone https://github.com/monk-coder/shape-areas.git
cd shape-areas
uv venv .venv
uv sync

Usage

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}"
)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages