A simple calculator that can perform the following operations:
Project description
Turing Data Science Calculator
TuringDSCalculator contains simple Calculator that can perform the following operations:
- add - add the current value with a number.
- subtract - subtract a number from the current value.
- multiply - multiply the current value by a number.
- divided - divide the current value by a number.
- root - take the n-th root of the current value.
- reset - change the current value back to default, 0.
Its memory is limited at 1.7976931348623157e+308
Installation
pip install TuringDSCalculator
Usage
Using the 5 operations in Calculator:
>>> from TuringDSCalculator import Calculator
# Create a new instance of Calculator
calculator = Calculator()
# Add two numbers
calculator.add(3)
calculator.add(7)
# Get the result
result = calculator.getResult()
print(result) # Output: 10.0
# Subtract a number
calculator.subtract(2)
# Get the result
result = calculator.getResult()
print(result) # Output: 8.0
# Multiply by a number
calculator.multiply(5)
# Get the result
result = calculator.getResult()
print(result) # Output: 40.0
# Divide by a number
calculator.divided(2)
# Get the result
result = calculator.getResult()
print(result) # Output: 20.0
# Take the 3rd root of the current value
calculator.root(3)
# Get the result
result = calculator.getResult()
print(result) # Output: 2.7144176165949083
# Reset the calculator's memory to 0
calculator.reset()
# Get the result
result = calculator.getResult()
print(result) # Output: 0.0
Contributing
I welcome pull requests for this Sprint 1 project. If you plan to make significant changes, I recommend that you open an issue first to discuss your proposed changes. Please ensure that you add or update tests as appropriate.
Changelog
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
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 TuringDSCalculator-0.0.3.tar.gz.
File metadata
- Download URL: TuringDSCalculator-0.0.3.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a904cbea80f8a9ca39dd6fe17124f92834cc452fc21329c897148ff74cc31fa
|
|
| MD5 |
ea7612338c0cc8794161dc73aa57e244
|
|
| BLAKE2b-256 |
3a7f5e32affa926aa5ebc196f857f2a301fc3453cbb25ece09ced1f07a011323
|
File details
Details for the file turingdscalculator-0.0.3-py2.py3-none-any.whl.
File metadata
- Download URL: turingdscalculator-0.0.3-py2.py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e724cca3dd8704a8d2029c6eb72c05c717d5b4ca6b36907148e6b283f34bd280
|
|
| MD5 |
5c77ce68bf6174c95d38118daf743029
|
|
| BLAKE2b-256 |
fd26caacdd35eddeb50a0690708f28f598bd02212faf14316b4ec821349d9329
|