a simple calculator
Project description
Calculator
The Calculator class provides a basic calculator with memory storage, supporting various mathematical operations. It allows users to perform addition, subtraction, multiplication, division, and Nth root calculations. The calculator also provides functionality to reset its memory to its initial state.
Installation
You can install the Calculator package using pip:
# Install package
pip install calculator_sf
Usage
Creating a Calculator
from calculator_module import Calculator
# Create a calculator with default memory (0.0)
calculator = Calculator()
# Create a calculator with an initial memory of 5.0
calculator_with_memory = Calculator(memory=5.0)
Performing Operations
Addition
calculator.add(5.0)
Subtraction
calculator.subtract(2.0)
Multiplication
calculator.multiply(3.0)
Division
calculator.divide(2.0)
Nth root
calculator.n_root(2)
Reset memory
calculator.reset()
Getting Current Values
# Get current memory value
current_memory = calculator.get_memory()
Get current decimal places setting
decimal_places = calculator.get_decimal_places()
Testing
pip install pytest
pytest test_calculator.py
Contributing
Feel free to contribute by opening issues or pull requests. Bug reports, suggestions, and improvements are welcome!
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
calculator_sf-0.2.0.tar.gz
(7.0 kB
view hashes)
Built Distribution
Close
Hashes for calculator_sf-0.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13d71eaf27ddf43211e453cdb7a3ed698551d0d6935a54eae049b43d0030413b |
|
MD5 | 1283fca8210ed2e9572e58bec1419b1a |
|
BLAKE2b-256 | 94cb1d1816b66dd457fd4dfeb751e75e526cd7cb0c82fb1cbdd8072ecb573bfd |