=======
This is a simple calculator project implemented in Python. It provides basic arithmetic operations such as addition, subtraction, multiplication, and division.
simple-calculator
├── src
│ ├── calculator.py
│ └── utils.py
├── tests
│ └── test_calculator.py
├── requirements.txt
└── README.md
- Addition: Adds two numbers.
- Subtraction: Subtracts one number from another.
- Multiplication: Multiplies two numbers.
- Division: Divides one number by another with error handling for division by zero.
To install the required dependencies, run the following command:
pip install -r requirements.txt
- Import the
Calculatorclass from thecalculatormodule. - Create an instance of the
Calculator. - Use the methods
add,subtract,multiply, anddivideto perform calculations.
from src.calculator import Calculator
calc = Calculator()
result = calc.add(5, 3)
print(result) # Output: 8To run the unit tests for the calculator, use the following command:
pytest tests/test_calculator.py
This project is licensed under the MIT License.