Skip to content

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.

License

Notifications You must be signed in to change notification settings

Rahul-404/Flask-Web-Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask Web Calculator🧮

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.

Features

  • Perform arithmetic operations: addition, subtraction, multiplication, and division.
  • Accepts input via JSON format for easy testing with tools like Postman.

Usage

Installation

  1. Clone this repository to your local machine:

    git clone https://github.com/Rahul-404/Flask-Web-Calculator.git
  2. Navigate to the project directory:

    cd Flask-Web-Calculator
  3. Install the required dependencies:

    pip install -r requirements.txt

Running the Application

  1. Start the Flask server:

    python app.py
  2. The server will start running on http://localhost:5000/.

Using the Calculator

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.

Example

Request

POST /calculate HTTP/1.1
Host: localhost:5000
Content-Type: application/json

{
  "operation": "add",
  "number1": 5,
  "number2": 3
}

Response

{
  "result": 8
}

In: POSTMAN

POSTMAN

Contributing

Contributions are welcome! If you'd like to contribute to this project, please fork the repository and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages