This script will allow you to solve for a missing side of a right triangle.
This script runs automatically, so for the best experience:
- Load the script to your calculator
- In the python app, use the three dots beside the script name to access the options
- Toggle off “Auto import to shell”
- Execute the script in the options
- Back out and execute again to solve repeatedly
from math import sqrt print("Right Triangle Solver") print("a and b are legs") print("c is the hypotenuse") side = input("Solve for a, b, or c? ") if side == "a": b = float(input("b = ")) c = float(input("c = ")) a = sqrt(c**2 - b**2) print("a =", a) elif side == "b": a = float(input("a = ")) c = float(input("c = ")) b = sqrt(c**2 - a**2) print("b =", b) elif side == "c": a = float(input("a = ")) b = float(input("b = ")) c = sqrt(a**2 + b**2) print("c =", c) else: print("Please enter a, b, or c.")