Basic math operations with internal memory.
Project description
Calculator
Perform basic math operations with internal memory
Calculator methods:
- add - add a real number to the internal memory value
- subtract - subtract a real number from the internal memory value
- multiply - multiply the internal memory value by a real number
- divide - divide the internal memory value by a real number
- root - take (n) root of the internal memory value
- reset - reset the internal memory value
Installation
pip install pycalc3
Usage
>>> from pycalc3.calculator import Calculator
>>> cal = Calculator()
>>> cal.add(12)
>>> cal.memory_value
12.0
>>> cal.subtract(3)
>>> cal.memory_value
9.0
>>> cal.multiply(3)
>>> cal.memory_value
27.0
>>> cal.divide(3)
>>> cal.memory_value
9.0
>>> cal.root(2)
>>> cal.memory_value
3.0
>>> cal.reset()
>>> cal.memory_value
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
pycalc3-0.0.3.tar.gz
(7.4 kB
view hashes)