A use of the square root in math is in the Pythagorean theorm, which allows you
to find the length of a side of a right triangle, if you know the length of the other two sides. The
theorem states that
$$c^2=a^2+b^2$$
given that $c$ is the side of the right triangle opposite to the right angle. The other two sides, $a$ and $b$
are the "legs" of the right triangle.
In this lesson, we'll see if you can program in the pythagorean theorem and have the computer calculate the length
of the hypotenuse of a right triangle, given that you know the other two sides.
Now you try. Use the print statement to find the length of hypotenuse of other right triangles.
Type your code here:
See your results here:
Do you agree that the default code here will find the hypotenuse given two legs of length 5 and 3? Try finding
the length of the hypotenuse for a variety of right triangle legs.
Share your code
Show a friend, family member, or teacher what you've done!