You will write three functions for the lengths in a triangle. The sides are , and , in cm.
The idea. The bisector from meets at with . The median from has length . Stewart's theorem says that a cevian of length , with , obeys .
Your tasks.
bisector_foot(a, b, c). Return .median(a, b, c). Return the length of the median from .stewart_ok(a, b, c, m, d). Return True when Stewart's equation holds to within 1e-9, and False otherwise.Run your code once to unlock the worked solution.
Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…