# Lesson goal: The Pythagorean Theorem Calculator

Previous: Solving Quadratic Equations | Home | Next: Fermat's Last Theorem

In this past lesson, you learned how to use the square root, or math.sqrt to compute the hypotenuse of a right triangle using the Pythagorean Theorem, which is $c^2=a^2+b^2$.

In this lesson, we'll use the if statement and develop this more into a complete Pythagorean Theorem calculator.

This code will ask you for then length of all 3 sides of a right triangle. For the side you don't know, type in a question mark (?). A series of if statements can be used to figure out which side to calculate for you.

# Now you try. Fix each if statement with a true/false question to see if the variable computed within its body is the one for which the user typed a ?.

This code will not run as-is. You have to fix each if statement to see if the variable computed within the body of the if statement is the one that has the ? symbol in it. Dismiss.
Show a friend, family member, or teacher what you've done!