Pythagorean Theorem Hypotenuse Calculator

  • Share this:

Code introduction


Calculate the length of the hypotenuse of a right triangle using the Pythagorean theorem.


Technology Stack : math (mathematical computation)

Code Type : Mathematical calculation

Code Difficulty : Beginner


                
                    
import math
import os
import random

def calculate_hypotenuse(a, b):
    return math.sqrt(a**2 + b**2)