Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/WorkTeam01/team-practice/llms.txt

Use this file to discover all available pages before exploring further.

Both the GUI and the CLI share the same core math module (src/calculator.py), so every arithmetic operator and scientific function works identically in both interfaces — the same inputs produce the same outputs regardless of how you launch the calculator. The only feature that differs between the two interfaces is parenthesized expression syntax, which is exclusive to the GUI.

Basic arithmetic

All five basic operations accept any two real numbers (float). Intermediate results keep Python’s native float precision.
OperationSyntax (CLI)ExampleResult
Additiona + b2 + 35
Subtractiona - b10 - 46
Multiplicationa * b5 * 630
Divisiona / b15 / 35.0
Exponentiationa ^ b2 ^ 416.0
In the GUI, enter the first number, click the operator button (or press the matching key), enter the second number, and press =. In the CLI, type all three tokens separated by spaces (e.g. 5 * 6) and press Enter.

Scientific functions

The three scientific functions are implemented as pure functions in calculator.py. abs_value is a unary operation (one argument); valor_maximo and valor_minimo are binary operations (two arguments).
FunctionSignatureDescriptionExampleResult
abs(x)abs_value(a: float) -> floatReturns the absolute value of a — converts any negative number to its positive equivalent-5 abs5
max(a, b)valor_maximo(a: float, b: float) -> floatReturns the larger of the two numbers; returns either value if they are equal10 max 2020
min(a, b)valor_minimo(a: float, b: float) -> floatReturns the smaller of the two numbers; returns either value if they are equal10 min 55
Using abs in the GUI: enter a number (e.g. -5), then click abs. The result replaces the current display value immediately — no = press needed. Using max / min in the GUI: click max or min after entering the first number (just like pressing + or -), then enter the second number and press =. Using abs in the CLI: type the number followed by abs, e.g. -7 abs. max and min use the standard binary format: 10 max 20.

Parenthesized expressions

The GUI supports full expression mode when ( is entered. In this mode the entire expression string — including nested parentheses — is built character by character in the display and evaluated atomically when = is pressed. Internally the calculator replaces ^ with Python’s ** before calling eval, and it validates that only digits, spaces, and the characters +-*/^(). are present (regex ^[\d\s\+\-\*\/\^\(\)\.]+$). The following expressions are all valid in GUI expression mode:
ExpressionResult
(2+3)*420
2*(3+4)14
(5-2)*(6+4)30
((2+3)*4)/54.0
(2+3)^225
Parenthesized expression syntax is GUI-only. The CLI parser expects exactly two or three space-separated tokens (num1 operator num2 or num function) and does not evaluate multi-operator strings. To compute (2+3)*4, launch the GUI with python src/gui.py.
Because the expression-mode regex only allows digits and +-*/^()., the words abs, max, and min are not usable inside a parenthesized expression in the GUI. Use those buttons in normal (non-parenthesis) mode.

Error conditions

The table below lists every condition that causes the calculator to raise an error, the underlying Python exception or validation check that triggers it, and where the error surfaces.
ConditionUnderlying causeError messageInterface
Division by zeroZeroDivisionError raised by divide()No se puede dividir por 0 (GUI) · No se puede dividir por cero (CLI, from exception message)Both
Negative base with even-root exponent (e.g. (-8)^0.5)ValueError("Raíz negativa") raised by power()Raíz negativaBoth
Unbalanced parentheses (e.g. (2+3*4)expression.count('(') != expression.count(')') check in equals_clickParéntesis desbalanceadosGUI only
Invalid expression characters (e.g. letters inside expression mode)Regex ^[\d\s\+\-\*\/\^\(\)\.]+$ does not matchExpresión inválidaGUI only
Expression evaluation SyntaxErrorMalformed expression string passed to evalSintaxis incorrectaGUI only
= pressed before the second number is enteredfirst_number set, operator set, current_value emptyIngresa el segundo númeroGUI only
abs clicked with only - in the displaycurrent_value == "-" check in unary_operationNúmero incompletoGUI only
Non-numeric token in normal modeValueError from float(current_value) (not Raíz negativa)Entrada inválidaGUI only
Non-numeric token in CLI inputValueError from float() conversionError: Ingresa números válidosCLI only
Unknown operator in CLI (3-token input)Operator not in the recognised setOperador '…' no válidoCLI only
Unknown function in CLI (2-token input)Function is not absFunción '…' no válidaCLI only
Wrong number of tokens in CLIlen(parts) is not 2 or 3Formato inválidoCLI only
After any error in the GUI, the display is cleared and all internal state (first number, operator, expression) is reset. You must re-enter the full calculation from the beginning. Error labels auto-dismiss after 3 seconds, but the reset happens immediately.

Build docs developers (and LLMs) love