Simple calculator, performing basic functions
Project description
Hello!
For the Module 1 Sprint 1 project I was supposed to create a Python package that is capable of conducting basic calculator-like functions, including:IMPORTANT note! Calculator is capable of accepting both integers and float numbers.
How to use it?
1. First of all, let's install the package. It can be accessed both - in your local machine and remote (like Google Colab)
pip install TACalculator-v3
2. Import module "Calculator" from a package
from file.calculator import Calculator
3. Create an instance of the Calculator class:
calculator = Calculator()
*IMPORTANT note: By default calculator's memory is set to 0.0
Known biases, possible areas for improvement:
- Error handling and input validation. It is expected that user will by himself handle possible Errors i. e. (division by Zero, math with string values, etc.)
- Additional functionality. Calculator can easily have more algebra functions.
Main functions
Addition
To add a value to the memory value, use the add(value)
method. This will add 12.0 to the memory value and will return the new value.
calculator.add(12.0)
Substraction
To subtract a value from the memory value, use the subtract(value)
method. This will subtract 5.0 from the memory value and will return the new value.
calculator.subtract(5.0)
Multiplication
To multiply the memory value by a value, use the multiply(value)
method. This will multiply the memory value by 6.0 and will return the new value.
calculator.multiply(6.0)
Division
To divide the memory value by a value, use the divide(value)
method. This will divide the memory value by 2.0 and will return the new value.
calculator.divide(2.0)
Root
To take the 1/nth root of the memory value, use the root(value)
method. This will take the third level root of the memory value and will return the new value.
calculator.root(3)
Reset
To reset the memory value to 0.0, use the reset()
method. This will reset the memory value to 0.0 and will return the 0.0 value.
calculator.reset()
Thank you for you attention!
I am open for a feedback!
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
Built Distribution
Hashes for TACalculator_v3-0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1a8be2b0d5b662de50a49deb13e8524528d20b3b291da8c454725c4ba1055b4 |
|
MD5 | 99ab17ba62d5bb5be9d108949e20e880 |
|
BLAKE2b-256 | 54c00e99634519bc3ec1fe63b338c9e81c345017f27ebf06c7680c177f17f92b |