Python program to solve this Pythagorous theorem.

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
  1. Take two sides of a triangle as input.
  2. Find the hypotenuse side by using Pythagoras’ theorem (a2 + b2 = c2)
  3. Find the square root of the hypotenuse side using the math library.
  4. 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
				
			

Interchange values between variables.

solve the given math formula. Formula : (a + b)2 = a^2 + b^2 + 2ab

Leave a Comment