Skip to main content

A Python package for basic arithmetic operations.

Project description

Calcat Calculator Package

A Python package for basic arithmetic operations. This package provides a Calculator class that allows users to perform addition, subtraction, multiplication, division, exponentiation, and extraction of roots. The Calculator class also features memory functionality, allowing users to store and manipulate results.

Installation

You can install the calculator package using pip:

pip install calcat-package

You can also explore the package on Google Collab: Link.

Calcat package on PyPI: Link

Usage

Basic Usage

from calcat_package.src.calcat_package_aginsideout.calculator import Calculator

# Create a calculator object
calc = Calculator()

# Perform arithmetic operations
result = calc.add(5, 3)  # Addition: 5 + 3
print(result)  # Output: 8

result = calc.subtract(5, 3)  # Subtraction: 5 - 3
print(result)  # Output: 2

result = calc.multiply(5, 3)  # Multiplication: 5 * 3
print(result)  # Output: 15

result = calc.divide(15, 3)  # Division: 15 / 3
print(result)  # Output: 5

result = calc.power(5, 3)  # Raising to the power: 5 ** 3
print(result)  # Output: 125

result = calc.root(8, 3)  # Root extraction: 3 √ 8
print(result)  # Output: 2

This will start an interactive session where you can choose operations and input numbers directly in the terminal.

## Available Operations

- **Addition:** `calc.add(x, y)` - Adds `x` and `y`.
- **Subtraction:** `calc.subtract(x, y)` - Subtracts `y` from `x`.
- **Multiplication:** `calc.multiply(x, y)` - Multiplies `x` and `y`.
- **Division:** `calc.divide(x, y)` - Divides `x` by `y`.
- **Exponentiation:** `calc.power(x, y)` - Raises `x` to the power of `y`.
- **Root Extraction:** `calc.root(x, y)` - Extracts the `y`-th root from `x`.

## Memory Functionality

The `Calculator` class has a built-in memory. The result of the last operation is stored in the memory and can be accessed using `calc.memory`. You can reset the memory to 0 using `calc.reset_memory()`.

```python
# Example of memory usage
result = calc.add(2, 3)  # Result = 5, memory = 5
print(calc.memory)  # Output: 5

calc.reset_memory()  # Reset the memory to 0
print(calc.memory)  # Output: 0

License

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

For more information, visit the GitHub repository.

Feel free to contribute and report issues!

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

calcat_package-1.5.0.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file calcat_package-1.5.0.tar.gz.

File metadata

  • Download URL: calcat_package-1.5.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.5

File hashes

Hashes for calcat_package-1.5.0.tar.gz
Algorithm Hash digest
SHA256 356d706f57d60097e1ea1140b11d33fb5292f35d4ccd7ea603c9e30aec5a8b15
MD5 d7af8614ce503dfcb8c0fbab58b3effb
BLAKE2b-256 dc5571034ce7c8ae5000747f83b25130f014545fa93547a71becf16da0b03406

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