The project is a simple command-line calculator that can evaluate mathematical expressions in infix notation. The program will throw an error if the expression is not valid and why.
- All the operators must be explicitly written within the expression. For example,
2(3 + 4)
is not a valid expression, but2 * (3 + 4)
is. - Negative numbers must be written without spaces. For example,
-3 * 2
is a valid expression, but- 3 * 2
is not. - Functions
sin
andcos
expect their arguments to be in radians and take exactly one argument. - The
min
andmax
functions take exactly two arguments.
Get started by downloading the latest GitHub release.
poetry install
Start the CLI tool and enter your mathematical expressions in the prompt. Input must be in infix notation and can contain the following tokens:
- Positive and negative integers
- Parentheses:
()
- Basic operators:
+
,-
,*
,/
- Powers:
^
- Minmax:
min()
,max()
- Trigonometric functions:
sin()
,cos()
- Available constants:
pi
- Available variables:
a-z
poetry run poe cli
Quit the program by typing
:q
in the prompt
View the help page by typing
:h
in the prompt
Run the tests with pytest:
poetry run poe test
Generate a coverage report in the htmlcov
directory with coverage:
poetry run poe coverage
Lint the code with pylint:
poetry run poe lint