Area of largest isosceles triangle that can be inscribed in an Ellipse whose vertex coincides with one extremity of the major axis | Python 3 program for the above approach ; Function to calculate area of the isosceles triangle ; If a and b are negative ; Stores the area of the triangle ; Print the area ; Driver code ; Given value of a & b ; Function call to find the area of the isosceles triangle
from math import sqrt NEW_LINE def triangleArea ( a , b ) : NEW_LINE INDENT if ( a < 0 or b < 0 ) : NEW_LINE INDENT print ( - 1 ) NEW_LINE return NEW_LINE DEDENT area = ( 3 * sqrt ( 3 ) * a * b ) / ( 4 ) ; NEW_LINE print ( " { : . 5f } " . format ( area ) ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT a = 1 NEW_LINE b = 2 NEW_LINE triangleArea ( a , b ) NEW_LINE DEDENT