Skip to content

Latest commit

 

History

History
70 lines (46 loc) · 1.74 KB

USAGE.md

File metadata and controls

70 lines (46 loc) · 1.74 KB

Usage Guide

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.

Gotchas

  • All the operators must be explicitly written within the expression. For example, 2(3 + 4) is not a valid expression, but 2 * (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 and cos expect their arguments to be in radians and take exactly one argument.
  • The min and max functions take exactly two arguments.

Getting Started

Get started by downloading the latest GitHub release.

Prerequisites

1. Install dependencies with Poetry:

poetry install

2. Run the program:

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

Running tests

Run the tests with pytest:

poetry run poe test

Generating a coverage report

Generate a coverage report in the htmlcov directory with coverage:

poetry run poe coverage

Linting the code

Lint the code with pylint:

poetry run poe lint