An extraordinarily basic calculator package
Project description
Calculator
This is a simple Python calculator that supports addition, subtraction, multiplication, and division, as well as taking roots.
Installation
You can install calculator using pip. First, open a terminal window and run the following command:
pip install calculator
Usage
To use the calculator, first import the Calculator class and create an instance of it:
from calculator import Calculator
calculator = Calculator()
You can then use the following methods to perform calculations: add(x): Add x to the current value in the calculator. subtract(x): Subtract x from the current value in the calculator. multiply_by(x): Multiply the current value in the calculator by x. divide_by(x): Divide the current value in the calculator by x. take_root(x): Take the xth root of the current value in the calculator. reset_memory(): Reset the value in the calculator to 0.
Here's an example usage:
calculator = Calculator()
calculator.add(5)
print(calculator.value) # Output: 5
calculator.multiply_by(3)
print(calculator.value) # Output: 15
calculator.divide_by(2)
print(calculator.value) # Output: 7.5
calculator.take_root(3)
print(calculator.value) # Output: 1.9365
calculator.reset_memory()
print(calculator.value) # Output: 0
Requirements
The package does not have any external dependencies.
License
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
File details
Details for the file calculator_2023_02_15-0.1.tar.gz
.
File metadata
- Download URL: calculator_2023_02_15-0.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a9ea442c3adcbbcdc00f711485720a5e6de7e999535d430b48f72f09bf2e86e |
|
MD5 | 8373f5f5d1b14eb299d3bd4b79e55f32 |
|
BLAKE2b-256 | 4105947ca80daeb316faf34206c39d0d1ecfb7e7c0c3aedd932d57abb4573ab3 |
File details
Details for the file calculator_2023_02_15-0.1-py3-none-any.whl
.
File metadata
- Download URL: calculator_2023_02_15-0.1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99ed31c82b664d5d5b11d38601a83e1519cce37df9a5651176d3807d5cf75f82 |
|
MD5 | 6744c5e21b32e47765bb16c18b3d971a |
|
BLAKE2b-256 | 5f993a54a9e4cb9461c81b81f71f0f051fc6d48ccaab2081c7254b4a9904d52d |