The CLI is an interactive REPL-style session that reads one expression per line from standard input and prints the result immediately. It accepts two input formats: a binary formatDocumentation 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.
num1 operator num2 for two-operand operations, and a unary format num function for single-operand functions like abs. No graphical environment is required, making it ideal for remote servers or quick scripted use.
Launching the CLI
Start the interactive session from the project root:Input format
The CLI parser splits each line on whitespace and expects either three tokens (binary) or two tokens (unary).5+3) are not parsed and will return a format error.
Supported operators
| Operator | Type | Description | Example input | Output |
|---|---|---|---|---|
+ | Binary | Addition | 5 + 3 | 8.0 |
- | Binary | Subtraction | 10 - 4 | 6.0 |
* | Binary | Multiplication | 5 * 6 | 30.0 |
/ | Binary | Division | 15 / 3 | 5.0 |
^ | Binary | Exponentiation | 2 ^ 4 | 16.0 |
max | Binary | Returns the larger of two numbers | 10 max 20 | 20.0 |
min | Binary | Returns the smaller of two numbers | 10 min 5 | 5.0 |
abs | Unary | Absolute value | -7 abs | 7.0 |
Example session
The following transcript shows a complete interactive session, including valid operations and several error cases:Exiting the CLI
There are two ways to end the interactive session:- Type
quitat the prompt and press Enter. The program prints¡Hasta luego!and exits cleanly. - Press Ctrl+C at any point. The
KeyboardInterruptis caught gracefully and the same farewell message is printed.
Error handling
The CLI prints human-readable error messages inline and immediately resumes the input prompt.| Error message | Cause |
|---|---|
Operador '…' no válido | Three-token input where the operator is not one of +, -, *, /, ^, max, min |
Función '…' no válida | Two-token input where the function is not abs |
Formato inválido | The input did not split into exactly two or three whitespace-separated tokens |
Error: Ingresa números válidos | One or both number tokens could not be converted to float (e.g. letters were entered) |
Error: No se puede dividir por cero | The divisor supplied to / is 0 |
