A small calculator package
Project description
Calculator
Overview
This Calculator is a simple Python class designed to perform basic arithmetic operations including addition, subtraction, multiplication, and division. It can also calculates the n-th root of a number and reset the current result.
Features
- Basic Arithmetic Operations: Perform addition, subtraction, multiplication, and division.
- N-th Root Calculation: Calculate the n-th root of the current result.
- Reset Memory: Calculator has its own memory and it manipulates its starting number 0 until it is reset.
- Input Validation: Validates all inputs to ensure they are numeric.
- Error Handling: Handles invalid root calculations when the root is even and the number is negative
Installation
This package has been uploaded on PyPI and you can install it using pip
pip install calculator-JN
Usage
Initialization
Create an instance of the Calculator class:
from calculator import Calculator
calc = Calculator()
Performing Operations
You can perform arithmetic operations as follows:
result = calc.add(5)
result = calc.subtract(2)
result = calc.multiply(3)
result = calc.divide(4)
result = calc.n_root(2)
Resetting the Calculator
Reset the calculator to its initial state:
calc.reset()
Requirements
Python 3.x
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file calculator-JN-0.0.2.tar.gz.
File metadata
- Download URL: calculator-JN-0.0.2.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27bbf391ffdf44611cf0288e00a10baf156d5184a228e94f4759b1b3f9f7a833
|
|
| MD5 |
da094c772c353a919deeb383633c3476
|
|
| BLAKE2b-256 |
d2a31a60759d78b966c06c383d1663ce0b96aa6ba542977d17f4a5f3c81ae4ad
|
File details
Details for the file calculator_JN-0.0.2-py3-none-any.whl.
File metadata
- Download URL: calculator_JN-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51cb529389e6272fd317487a28b96c9acac4229f0ed5b7104ec8e727804ed641
|
|
| MD5 |
07f6510e0236ba5af85bc710afbfcbe7
|
|
| BLAKE2b-256 |
85ef0b7102d9d003b51738765616f1e0438bccd8907604e1c12d30f401c2699f
|