Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sebastian-huynh/polygon-area-calculator

User-defined python package that return various geometric properties based on a shape's width and height.
https://github.com/sebastian-huynh/polygon-area-calculator

calculator-application calculator-python geometry polygon python python-3 python3

Last synced: 24 days ago
JSON representation

User-defined python package that return various geometric properties based on a shape's width and height.

Awesome Lists containing this project

README

        

# Polygon Calculations With Python
This is one of the practices I completed for the "Scientific Computing with Python" certificate from freecodecamp.org.

"test_module" and "main" were already given, "shape_calculator" is the file I developed code in.


**Practice Instructions**: [View Here](https://www.freecodecamp.org/learn/scientific-computing-with-python/scientific-computing-with-python-projects/polygon-area-calculator)

**Replit link to test run this project for yourself**: [View Here](https://replit.com/@sebastian-huynh/polygon-area-calculator)


There are two classes of polygons that this project focuses on:

- **Rectangle** objects initialize with two parameters in case of differing lengths between shape height and width.

- **Square** objects initialize with only one parameter for the length of a side (as squares have the same length on all sides) and inherits the methods from the **Rectangle** class as a subclass.

"shape_calculator" holds methods that can be called from main to set/mutate or get/return the width/height values of a particular shape. It also contains further methods for:

- **measuring diagonal length** (even for squares as the width and height are derived from the given side length for calculations)
- **seeing how many of X shapes will fit in Y shape** (done by diving the areas of the two shapes)

![image](https://github.com/sebastian-huynh/polygon-area-calculator/blob/main/Screenshot%202023-12-26%20233928.png)

_NOTE: to show full project code that is being tested click the "<>" sign_