Pythagorean Theorem Calculator Flask Web Service
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
Development of a Pythagorean Theorem Calculator Flask Web Service for a job interview test.
The main features of this application are:
- Calculation of the hypotenuse from the two sides;
- Calculation of the side from the hypotenuse and the other side;
The main technologies used for the development of this project are:
Other repositories related to the development of this project:
To clone and run this project locally, follow these simple example steps:
To run this project, you need to install:
After that, install the following requirements.txt:
Flask==1.1.2
flask_restful==0.3.8
Click==7.0
gunicorn==19.9.0
itsdangerous==1.1.0
Jinja2==2.10.1
MarkupSafe==1.1.1
Werkzeug==0.15.6
- Clone the repo
git clone https://github.com/gspetillo/pythagorean-calculator-api.git
- Run the main.py file at the root of the project directory
python main.py
- Access the local IP address generated by the web service (example using the default IP and port)
start http://127.0.0.1:5000/
This wb service can be used to perform simple calculations involving the Pythagorean theorem. The main formulas of this theorem used in this project are:
c = √(a² + b²)
a = √(c² - b²) or b = √(c² - a²)
For examples, please acess Khan Academy.
To access the web service data, use the routes as shown below. The examples use the default IP and port when starting the service.
/hypotenuse
Returns the result of the hypotenuse calculation using sideA and sideB passed as a parameter.
-
Request:
http://127.0.0.1:5000/hypotenuse?sideA=3.0&sideB=4.0
- Response:
{ "status": 200, "data": 5 }
/side
Returns the result of the side calculation using the hypotenuse and the side passed as a parameter
-
Request
http://127.0.0.1:5000/side?hypotenuse=5.0&side=4.0
-
Response:
{ "status": 200, "data": 3 }
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project (Fork button on Github)
start https://github.com/gspetillo/pythagorean-calculator-api- Create your Feature Branch
git checkout -b feature/AmazingFeature- Commit your Changes
git commit -m 'Add some AmazingFeature'- Push to the Branch
git push origin feature/AmazingFeature- Open a Pull Request (Pull Request page on Github)
start https://github.com/gspetillo/pythagorean-calculator-api/pullsDistributed under the MIT License. See LICENSE for more information.
Gabriel Petillo - Linkedin - Github - Medium - Email
Project Link: https://github.com/gspetillo/pythagorean-calculator-api
