Calculate area and height of an isosceles triangle whose sides are radii of a circle | Python3 program for the above approach ; Function to convert given angle from degree to radian ; Function to calculate height and area of the triangle OAB ; Stores the angle OAB and OBA ; Stores the angle in radians ; Stores the height ; Print height of the triangle ; Stores the base of triangle OAB ; Stores the area of the triangle ; Print the area of triangle OAB ; Driver Code
from math import sin , cos NEW_LINE def Convert ( degree ) : NEW_LINE INDENT pi = 3.14159265359 NEW_LINE return ( degree * ( pi / 180 ) ) NEW_LINE DEDENT def areaAndHeightOfTraingle ( radius , a ) : NEW_LINE INDENT if ( a >= 180 or a == 0 ) : NEW_LINE INDENT print ( " Not ▁ possible " ) NEW_LINE return NEW_LINE DEDENT base_angle = ( 180 - a ) / 2 NEW_LINE radians = Convert ( base_angle ) NEW_LINE height = sin ( radians ) * radius NEW_LINE print ( " Height ▁ of ▁ triangle ▁ " , round ( height , 1 ) ) NEW_LINE base = cos ( radians ) * radius NEW_LINE area = base * height NEW_LINE print ( " Area ▁ of ▁ triangle ▁ " , round ( area , 4 ) ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT R , angle = 5 , 120 NEW_LINE areaAndHeightOfTraingle ( R , angle ) NEW_LINE DEDENT