integer-calculator
Calculate addition, subtraction, multiplication and division of two integers via a Python script.
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.
- Downloads
- 346All time
- Security audit
- Pass
- Last updated
- 2mo ago
- Current version
- v1.1.0
- License
- MIT-0
