Skip to main content

A simple calculator package

Project description

Calculator Package

This package provides a simple calculator class. The fuctions available in calculator: Addition / Subtraction. Multiplication / Division. Take (n) root of a number.

Installation

You can install the package via pip:

pip install calculator-package-foxylex

Usage

from calculator.calculator import Calculator

# Create a new calculator instance
calc = Calculator()

# Perform arithmetic operations
calc.add(5)
print("Addition result:", calc.memory)  # Output: 5

calc.subtract(3)
print("Subtraction result:", calc.memory)  # Output: 2

calc.multiply(4)
print("Multiplication result:", calc.memory)  # Output: 8

calc.divide(2)
print("Division result:", calc.memory)  # Output: 4.0

calc.take_root(2)
print("Square root result:", calc.memory)  # Output: 2.0

# Reset the memory
calc.reset_memory()
print("Memory after reset:", calc.memory)  # Output: 0

Operations

The Calculator Package supports the following operations:

Addition Subtraction Multiplication Division Taking the nth root

Unit Tests

Unit tests for the Calculator Package are located in the tests/ directory. These tests ensure that each operation functions correctly and that error handling is implemented where necessary. To run the unit tests, use the following command:

python -m unittest tests.test_calculator

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-package-foxylex-1.0.0.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file calculator-package-foxylex-1.0.0.tar.gz.

File metadata

File hashes

Hashes for calculator-package-foxylex-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d262d0ed64c340c4dd0c5ed550f2d7898477dc6df7fd8aa96b781060bdf71021
MD5 2d1807ea2843068df9edc2767f051708
BLAKE2b-256 9a7abbceb8c18355b9353ed632e5cbc9aa27352d2762654b9be5d908698ade4f

See more details on using hashes here.

Supported by

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