kyu_3.calculator package¶
Submodules¶
kyu_3.calculator.calculator module¶
Create a simple calculator that given a string of operators (), +, -, *, / and numbers separated by spaces returns the value of that expression
-
class
kyu_3.calculator.calculator.
Calculator
[source]¶ Bases:
object
Given string of operators (), +, -, *, / and numbers separated by spaces. Returns the value of that expression.
-
__calculate
(char: str, strings: list)¶ Perform math operation
Reorganize math expression
- Parameters
i – char (math operation) index
char – math operation
strings – math expression
- Returns
result
-
__process_math_expression
(string: str, operators: list) → str¶ Perform all operation with: multiplications, divisions, additions and subtractions
- Parameters
string – input string
- Returns
output string with no ‘*’, ‘/’, ‘+’, ‘-‘
-
kyu_3.calculator.test_calculator module¶
Testing Calculator class