This is a calculator project for basic math functions.
Implemented methods:
- addition
- subtraction
- multiplication
- division
- n'th root
- sqrt
- power_nth (power of (n))
- pi
- reset memory
pip install basic-math-calculator
from basic_math_calculator.calculator import Calculator
Result is stored and overwritten in memory until reset() method is ran.
Calculation methods can take either one or two arguments (in addition to self).
If only one arguments is given calculations will be performed with memory value (latest result), otherwise calculations will be performed between two arguments and memory value will be overwritten.
For example:
>>> calc = Calculator()
>>> calc.addition(4, 5)
9
>>> calc.addition(10)
19
>>> calc.multiplication(2)
38
>>> calc.multiplication(2, 5)
10
>>> calc.reset()
0
python -m unittest test_calculator.py
This project is licensed under the terms of the MIT license