This is a simple web calculator application built using Flask, a lightweight Python web framework. The calculator allows users to perform basic arithmetic operations such as addition, subtraction, multiplication, and division.
- Perform arithmetic operations: addition, subtraction, multiplication, and division.
- Accepts input via JSON format for easy testing with tools like Postman.
-
Clone this repository to your local machine:
git clone https://github.com/Rahul-404/Flask-Web-Calculator.git
-
Navigate to the project directory:
cd Flask-Web-Calculator
-
Install the required dependencies:
pip install -r requirements.txt
-
Start the Flask server:
python app.py
-
The server will start running on
http://localhost:5000/
.
You can use the calculator by sending POST requests to the /calculate
endpoint with the following JSON payload:
{
"operation": "add",
"number1": 5,
"number2": 3
}
"operation"
: The arithmetic operation to perform (add
,subtract
,multiply
,divide
)."number1"
: The first number."number2"
: The second number.
The server will respond with the result of the calculation in JSON format.
POST /calculate HTTP/1.1
Host: localhost:5000
Content-Type: application/json
{
"operation": "add",
"number1": 5,
"number2": 3
}
{
"result": 8
}
Contributions are welcome! If you'd like to contribute to this project, please fork the repository and submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.