Skip to main content

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)

Uploaded Source

Built Distribution

calculator_sf-0.2.0-py2.py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page