Skip to content

Library for recursive evaluation of mathematical expressions as strings.

License

Notifications You must be signed in to change notification settings

mohamadnachabe/calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Calculator

Evaluates mathematical expressions as strings.

Example:

  from calculator.calculator import evaluate
  
  t = evaluate('(4 + 4) * 344 + (((6 + 7) * 1333) + 2 + 100000) * (30 + 2)')

evaluate_o is a more optimized version of evaluate. It avoids the usage of python's splitting operation in the recursive calls.

  from calculator.calculator_o import evaluate_o
  
  t = evaluate_o('(4 + 4) * 344 + (((6 + 7) * 1333) + 2 + 100000) * (30 + 2)')

Supported operations:

Operation Symbol
Addition +
Subtraction -
Multiplication *
Division /
Exponentiation ^
Grouping ( )

Releases

No releases published

Packages

No packages published

Languages