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.

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 format 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:
python src/cli.py
The welcome banner prints to the terminal and the prompt waits for your first expression:
=== Team Practice - Calculadora Demo ===
Este es un ejemplo de cómo usar el módulo calculator.

Ejemplos de operaciones:
2 + 3 = 5
10 - 4 = 6
5 * 6 = 30
15 / 3 = 5.0
2 ^ 4 = 16
-7 abs = 7
Valor máximo entre 10 y 20 = 20
Valor mínimo entre 10 y 20 = 10

Ejemplo de manejo de errores:
Error: No se puede dividir por cero

=== Calculadora Interactiva ===
Operaciones disponibles: +, -, *, /, ^, max, min
Escribe 'quit' para salir

Ingresa una operación (ej: 5 + 3):

Input format

The CLI parser splits each line on whitespace and expects either three tokens (binary) or two tokens (unary).
# Binary format: num1 operator num2
5 + 3
Resultado: 8.0

10 / 4
Resultado: 2.5

2 ^ 8
Resultado: 256.0

# Unary format: num function
-7 abs
Resultado: 7.0
Tokens must be separated by spaces. Expressions without spaces (e.g. 5+3) are not parsed and will return a format error.

Supported operators

OperatorTypeDescriptionExample inputOutput
+BinaryAddition5 + 38.0
-BinarySubtraction10 - 46.0
*BinaryMultiplication5 * 630.0
/BinaryDivision15 / 35.0
^BinaryExponentiation2 ^ 416.0
maxBinaryReturns the larger of two numbers10 max 2020.0
minBinaryReturns the smaller of two numbers10 min 55.0
absUnaryAbsolute value-7 abs7.0

Example session

The following transcript shows a complete interactive session, including valid operations and several error cases:
=== Calculadora Interactiva ===
Operaciones disponibles: +, -, *, /, ^, max, min
Escribe 'quit' para salir

Ingresa una operación (ej: 5 + 3): 5 + 3
Resultado: 8.0

Ingresa una operación (ej: 5 + 3): 15 / 3
Resultado: 5.0

Ingresa una operación (ej: 5 + 3): 2 ^ 8
Resultado: 256.0

Ingresa una operación (ej: 5 + 3): 10 max 20
Resultado: 20.0

Ingresa una operación (ej: 5 + 3): 10 min 20
Resultado: 10.0

Ingresa una operación (ej: 5 + 3): -7 abs
Resultado: 7.0

Ingresa una operación (ej: 5 + 3): 10 / 0
Error: No se puede dividir por cero

Ingresa una operación (ej: 5 + 3): 5+3
Formato inválido

Ingresa una operación (ej: 5 + 3): five + 3
Error: Ingresa números válidos

Ingresa una operación (ej: 5 + 3): 5 % 3
Operador '%' no válido

Ingresa una operación (ej: 5 + 3): -7 sqrt
Función 'sqrt' no válida

Ingresa una operación (ej: 5 + 3): quit

¡Hasta luego!

Exiting the CLI

There are two ways to end the interactive session:
  • Type quit at the prompt and press Enter. The program prints ¡Hasta luego! and exits cleanly.
  • Press Ctrl+C at any point. The KeyboardInterrupt is caught gracefully and the same farewell message is printed.
The CLI loop continues running after every error — you do not need to restart it. Simply type a corrected expression and press Enter.

Error handling

The CLI prints human-readable error messages inline and immediately resumes the input prompt.
Error messageCause
Operador '…' no válidoThree-token input where the operator is not one of +, -, *, /, ^, max, min
Función '…' no válidaTwo-token input where the function is not abs
Formato inválidoThe input did not split into exactly two or three whitespace-separated tokens
Error: Ingresa números válidosOne or both number tokens could not be converted to float (e.g. letters were entered)
Error: No se puede dividir por ceroThe divisor supplied to / is 0
The CLI does not support parenthesized expressions such as (2+3)*4. Parentheses are a GUI-only feature. To evaluate complex expressions, use python src/gui.py instead.

Build docs developers (and LLMs) love