Calculator App supports named session variables, letting you store a value once and reference it in as many expressions as you like without retyping the number. Variables live in a simple dictionary that persists for the entire session.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Seaus-tech/Calculator-App/llms.txt
Use this file to discover all available pages before exploring further.
Setting a Variable
Type the variable name, an equals sign, and the value. There must be no arithmetic operators (+, -, *, /) on the left-hand side.
How Assignment Is Detected
Incore.py, the input routing checks are ordered as follows:
= and a letter, a letter-named assignment like x=5 is handled by solve_equation() rather than the variable assignment block. The variable assignment block is only reached for inputs where the left side contains no alphabetic characters at all (e.g., a purely numeric left side).
The equation solver intercepts
x=5 and similar letter-named assignments before the variable assignment block can run. Variables are most reliably used by setting them through expressions that the solver processes, or by relying on the substitution that evaluator.py applies using whatever is already in the variables dict.Using Variables in Expressions
Once a variable is stored in thevariables dict, its name is substituted as a plain string into the expression before it reaches eval. This happens inside evaluator.py:
Full Session Example
Storage
Variables are defined invariables.py as a plain module-level dictionary:
core.py and evaluator.py import this same object, so assignments made at the prompt are immediately visible to every subsequent evaluation.
Variable substitution is a plain string replacement, so a variable named
x will also match inside longer names if they share the same characters. Keep variable names short and unambiguous (single letters or short distinct strings) to avoid unexpected substitutions.