Skip to content

SigisM/Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic calculator

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

Installation

pip install basic-math-calculator

from basic_math_calculator.calculator import Calculator

Usage

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

TestCase

python -m unittest test_calculator.py

License

This project is licensed under the terms of the MIT license

About

Basic math calculator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published