Bird
Raised Fist0

You want to calculate the hypotenuse of a right triangle with sides 3 and 4. Which code correctly does this?

hard🚀 Application Q8 of Q15
Python - Standard Library Usage
You want to calculate the hypotenuse of a right triangle with sides 3 and 4. Which code correctly does this?
Ahyp = 3**2 + 4**2
Bimport math hyp = math.pow(3 + 4, 2)
Cimport math hyp = math.sqrt(3**2 + 4**2)
Dhyp = math.sqrt(3 + 4)
Step-by-Step Solution
Solution:
  1. Step 1: Recall hypotenuse formula

    Hypotenuse = square root of (side1 squared + side2 squared).
  2. Step 2: Check code correctness

    import math hyp = math.sqrt(3**2 + 4**2) correctly squares sides, sums, then takes sqrt. Others either miss sqrt or sum squares incorrectly.
  3. Final Answer:

    import math hyp = math.sqrt(3**2 + 4**2) -> Option C
  4. Quick Check:

    Hypotenuse = sqrt(a² + b²) [OK]
Quick Trick: Hypotenuse = sqrt(side1² + side2²) [OK]
Common Mistakes:
MISTAKES
  • Adding sides before squaring
  • Missing sqrt call
  • Using pow incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes