Python Program To Check Three Input Values Representing Right Angled Triangle Or Not

Python Program To Check Three Input Values Representing Right Angled Triangle Or Not

Pythagoras-Theorem

The above image is showing the “Pythagoras theorem” where the sum of the “BASE” square and the “PERPENDICULAR” square is equal to the square of “HYPOTENUSE”. You can see one solved example in below image.

 

Example

def checkRightTriangle(BASE,PERPENDICULAR,HYPOTENUSE):
    if (HYPOTENUSE**2) == (BASE**2 + PERPENDICULAR**2):
        print("Given Input Values Are Represent Right Triangle")
    else:
        print("Given Input Values Are Not Represent Right Triangle")
 
def findMaxValue(a,b,c):
    if (c>b & c>a):
        checkRightTriangle(a,b,c)
    elif(a>b & a>c):
        checkRightTriangle(b,c,a)
    else:
        checkRightTriangle(a,c,b)

A=13
B=12
C=5
findMaxValue(A,B,C)

Output:

Given Input Values Are Represent Right Triangle

Leave a comment