Skip to content

gspetillo/pythagorean-calculator-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

Pythagorean Calculator API

Pythagorean Theorem Calculator Flask Web Service
Explore the docs »

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact
  7. Acknowledgements

About The Project

Product Name Screen Shot

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;

Built With

The main technologies used for the development of this project are:

Related Repositories

Other repositories related to the development of this project:

Getting Started

To clone and run this project locally, follow these simple example steps:

Prerequisites

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

Installation

  1. Clone the repo
    git clone https://github.com/gspetillo/pythagorean-calculator-api.git
  2. Run the main.py file at the root of the project directory
    python main.py
  3. Access the local IP address generated by the web service (example using the default IP and port)
    start http://127.0.0.1:5000/

Usage

Theory

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.

Routes

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:

/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:

/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
    }

Contributing

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.

  1. Fork the Project (Fork button on Github)
start https://github.com/gspetillo/pythagorean-calculator-api
  1. Create your Feature Branch
git checkout -b feature/AmazingFeature
  1. Commit your Changes
git commit -m 'Add some AmazingFeature'
  1. Push to the Branch
git push origin feature/AmazingFeature
  1. Open a Pull Request (Pull Request page on Github)
start https://github.com/gspetillo/pythagorean-calculator-api/pulls

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Gabriel Petillo - Linkedin - Github - Medium - Email

Project Link: https://github.com/gspetillo/pythagorean-calculator-api

Acknowledgements

About

Pythagorean Theorem Calculator Flask Web Service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages