In this Python basic program, we will solve the Pythogorous theorem, which states, the square of the hypotenuse is equal to the sum of squares of other sides of the right triangle.
a2 + b2 = c2
a = side of a right triangle
b = side of a right triangle
c = hypotenuse
Steps to solve the program
- Take two sides of a triangle as input.
- Find the hypotenuse side by using Pythagoras’ theorem (a2 + b2 = c2)
- Find the square root of the hypotenuse side using the math library.
- Print the output.
import math
a = 5 # site1 value
b = 4 # site2 value
hypo = a**2+b**2
print("Hypotenious side: ",math.sqrt(hypo))
Output :
Hypotenious side: 22.360679774997898