Integer Calculator
This skill calculates the addition, subtraction, multiplication or division of two integers by calling a local Python script.
Usage
When the user asks to perform arithmetic on two integers, run the following command:
python3 scripts/calculator.py
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| num1 | int | Yes | First integer |
| num2 | int | Yes | Second integer |
| operation | string | Yes | add, sub, mul, div |
Examples
Addition:
python3 scripts/calculator.py 3 5 add
# Output: 8
Subtraction:
python3 scripts/calculator.py 10 4 sub
# Output: 6
Multiplication:
python3 scripts/calculator.py 3 5 mul
# Output: 15
Division:
python3 scripts/calculator.py 10 4 div
# Output: 2.5
Notes
- Supported operations:
add,sub,mul,div. - Both inputs must be valid integers.
- Division returns a float result; dividing by zero will return an error message to stderr and exit with code 1.
- The script prints only the numeric result to stdout for easy parsing.
