Calculator module
Project description
Calculator
Does basic math operations
Methods :
- add - Adds the given number to the current number in the calculator memory
- subtract - Subtracts the given number from the current number in the calculator memory
- multiply - Multiplies current number in the calculator memory by the given number
- divide - Divides current number in the calculator memory by the given number
- root - Takes the given number root of the current number in the calculator
- reset - Resets calculator memory, default: 0
Installation
pip install nershcalculator
Usage
Addition of numbers:
>>> from nershcalculator import Calculator
>>> calculations = Calculator()
>>> calculations.add(5)
'5.0'
>>> calculations.add(10)
'15.0'
Subtraction of numbers:
>>> from nershcalculator import Calculator
>>> calculations = Calculator()
>>> calculations.subtract(5)
'-5.0'
>>> calculations.subtract(10)
'-15.0'
Number multiplication:
>>> from nershcalculator import Calculator
>>> calculations = Calculator(5)
>>> calculations.multiply(10)
'50.0'
>>> calculations.multiply(5)
'250.0'
Number division:
>>> from nershcalculator import Calculator
>>> calculations = Calculator(5)
>>> calculations.divide(5)
'1.0'
>>> calculations.divide(5)
'0.2'
Taking n root out of a number:
>>> from nershcalculator import Calculator
>>> calculations = Calculator(125)
>>> calculations.root(3)
'5.0'
Resetting calculator:
>>> from nershcalculator import Calculator
>>> calculations = Calculator()
>>> calculations.add(100)
'100.0'
>>> calculations.reset()
'0.0'
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
nershcalculator-0.3.1.tar.gz
(2.4 kB
view hashes)
Built Distribution
Close
Hashes for nershcalculator-0.3.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5a64981c732fd8758e8ef537392bfa13be02ac0a23f06684b5cea51e47a6f00 |
|
MD5 | e9f1b420981d28a1a36d7b52dbbe69a4 |
|
BLAKE2b-256 | 39e584d4d082050e30e79603784fd94a52544efcc654d4b97e4d6d5ae3234634 |