A simple python package that allows users to perform the most basic arithmetic functions.
Project description
CalclculatorPackage
Description
'Calculator' is a simple python package that allows users to perform the most basic arithmetic functions.
Available functions:
- Addition (
.add(n)) - Subtraction (
.subtract(n)) - Multiplication (
.multiply(n)) - Division (
.divide(n)) - N Root (
.n_root(n)) - Reset memory (
.reset())
Prerequisites
- Python
- Git
Installation and test run
Package can be installed and tested in the following way:
1. Create a Virtual Environment
Open your Command Prompt (CMD) and execute:
python -m venv {environment_name}
Replace {environment_name} with the desired name for your virtual environment.
2. Activate the Virtual Environment
In CMD, type:
{environment_name}\Scripts\activate
3. Install the package
With the virtual environment active, install the package using pip:
pip install CalculatorPackageTuringRokasSertvytis==1.2
4. Navigate to your .py script directory
Change your directory to where your Python script (that will use the package) is located:
cd {PATH_TO_PYTHON_SCRIPT_DIRECTORY}
Replace {PATH_TO_PYTHON_SCRIPT_DIRECTORY} with the path to your script.
5. Import package to the script (in .py file)
from calculator import Calculator
6. Create Calculator object (in .py file)
{calculator_variable_name} = calculator.Calculator()
Replace {calculator_variable_name} with a suitable variable name.
7. Use Calculator Functions (in .py file)
As an example, you can add numbers like so:
{calculator_variable_name}.add(2)
8. Run the script from Command Prompt (CMD)
python {python_script_name}.py
Replace {python_script_name} with the name of your Python script.
Package could also be imported more elegantly by just running the following command in the command line
pip install git+https://github.com/TuringCollegeSubmissions/rsertv-DWWP.1#egg=Calculator
,but since the project is currently in a private GitHub directory, this method will not work.
Function tests
Here are the expected results of each function:
calculator.add(5) #OUTPUT: 0 + 5 = 5
calculator.subtract(2) #OUTPUT: 5 - 2 = 3
calculator.multiply(9) #OUTPUT: 3 * 9 = 27
calculator.divide(3) #OUTPUT: 27 / 3 = 9
calculator.nRoot(2) #OUTPUT: 9 ^ (1/2) = 3
calculator.reset() #OUTPUT: Memory cleared
Tests
Package also includes tests which are located inside tests/calculator_test.py. One of the ways to run the test is to simply run calculator_test.py from command line when inside the test directory.
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 CalculatorPackageTuringRokasSertvytis-1.2.tar.gz.
File metadata
- Download URL: CalculatorPackageTuringRokasSertvytis-1.2.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86516e31f36cec32e94e97dbe51d58a32f59c54f768632a4dfa14c6926f193cd
|
|
| MD5 |
005661c8c60dcc5334b64cca44b4c141
|
|
| BLAKE2b-256 |
758aa100101766f613b146c8b71852b3be88e1b939a7d9158ed379c4c86f20a0
|
File details
Details for the file CalculatorPackageTuringRokasSertvytis-1.2-py3-none-any.whl.
File metadata
- Download URL: CalculatorPackageTuringRokasSertvytis-1.2-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
048a37262580485b2dbe3bf43ad08d8b3bf3212266e92992b827525d8a5b6dc0
|
|
| MD5 |
857b2741542c5ac3d6de2deb547e6395
|
|
| BLAKE2b-256 |
75396f1d0900b4b3d998e6f0704bf09293768ab24eb28c03d34f0e7cd3d14089
|