Calculator module for Turing College Data Science course Module 1 Sprint 1. Performs basic calculations with internal memory.
Project description
Calculator Project
A simple calculator module that provides basic arithmetic operations and memory management.
Structure
.
├── akvile_turing_calculator/
│ ├── __init__.py
│ └── calculator.py
├── tests/
│ ├── __init__.py
│ ├── test_add.py
│ ├── test_divide.py
│ ├── test_multiply.py
│ ├── test_reset.py
│ ├── test_root.py
│ └── test_subtract.py
├── LICENSE
├── README.md
├── requirements.txt
├── pyproject.toml
└── poetry.lock
Features
- Basic arithmetic operations: addition, subtraction, multiplication, division, and nth root.
- Memory management: store and use results from previous calculations.
- Type validation: ensures that the inputs are of appropriate types.
Installation
Poetry
To install with poetry use poetry add akvile-turing-calculator
pip
To install with pip use pip install akvile-turing-calculator
Usage
python
from akvile_turing_calculator.calculator import Calculator
calc = Calculator()
print(calc.add(5)) # Outputs: 5.0
print(calc.subtract(2)) # Outputs: 3.0
print(calc.multiply(4)) # Outputs: 12.0
print(calc.divide(3)) # Outputs: 4.0
print(calc.root(2)) # Outputs: 2.0
calc.reset() # Resets memory to 0.0
Testing
Tests are located in the tests/ directory and can be run using pytest.
To run all tests use pytest tests/.
Contributing
- Fork the repository.
- Create a new branch for your features or fixes.
- Write tests that cover your changes.
- Submit a pull request and provide a detailed description of your changes.
License
This project is licensed under the terms of the LICENSE file.
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 akvile_turing_calculator-0.1.0.tar.gz.
File metadata
- Download URL: akvile_turing_calculator-0.1.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.11.1 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78dad3ce507f46cbc1a57a44c86932d16568fb714b64d2438ddc7b03519751bc
|
|
| MD5 |
15928a56bf9219ec7379e7947a69328d
|
|
| BLAKE2b-256 |
626cedcec3c9f921d454457cadb37560d97603d06c619045c6993fd0b4d347bb
|
File details
Details for the file akvile_turing_calculator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: akvile_turing_calculator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.11.1 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05a510eb4d3d7b2864d171eaf41e8f58c5bc5f25969a4e2a7e1666075e19d441
|
|
| MD5 |
9ba42649397731781398279dea41891a
|
|
| BLAKE2b-256 |
2c6add3d6ff93044ab61c9a749336079280f1f89e1f718c2bbd7d21684865a86
|