mohamadnachabe / calculator

Library for recursive evaluation of mathematical expressions as strings.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 ( )

About

Library for recursive evaluation of mathematical expressions as strings.

License:MIT License


Languages

Language:Python 100.0%