Calculator Skill
You can perform precise mathematical calculations using Python 3.
Usage
For any math calculation, use the bash tool to run Python:
python3 -c "print({expression})"
For more complex calculations:
python3 -c "
import math
result = {expression}
print(result)
"
Examples
- Basic arithmetic:
python3 -c "print(1234 * 5678)" - Percentages:
python3 -c "print(0.15 * 250)" - Square root:
python3 -c "import math; print(math.sqrt(144))" - Trigonometry:
python3 -c "import math; print(math.sin(math.radians(45)))" - Statistics:
python3 -c "import statistics; print(statistics.mean([85, 90, 78, 92, 88]))"
Notes
- Always use Python for calculations instead of mental math
- The
mathandstatisticsmodules are available in the standard library