{"id":17894,"date":"2021-08-26T10:42:20","date_gmt":"2021-08-26T05:12:20","guid":{"rendered":"https:\/\/python-programs.com\/?p=17894"},"modified":"2021-11-22T18:37:13","modified_gmt":"2021-11-22T13:07:13","slug":"python-program-to-find-isosceles-triangle-area","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-find-isosceles-triangle-area\/","title":{"rendered":"Python Program to Find Isosceles Triangle Area"},"content":{"rendered":"
In the previous article, we have discussed Python Program to Find Volume and Surface Area of Sphere<\/a> An isosceles triangle is a triangle with two equal-length sides in geometry.It is sometimes stated as having exactly two equal-length sides and other times as having at least two equal-length sides, with the latter containing the equilateral triangle as a particular scenario.<\/p>\n Formula :<\/strong><\/p>\n The formula to find the area of an isosceles triangle = (y * math.sqrt((4 * x * x) – (y * y)))\/4;<\/strong><\/p>\n where x , y are the two side lengths of an isosceles triangle.<\/p>\n Given two sides of an isosceles triangle and the task is to find the area of the given isosceles triangle.<\/p>\n Examples:<\/strong><\/p>\n Example1:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Example2:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Below are the ways to find the area of the given isosceles triangle:<\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n The area is isosceles is calculated by the above formula.<\/p>\n Explore more instances related to python concepts from\u00a0Python Programming Examples<\/a>\u00a0Guide and get promoted from beginner to professional programmer level in Python Programming Language.<\/p>\n In the previous article, we have discussed Python Program to Find Volume and Surface Area of Sphere Isosceles triangle : An isosceles triangle is a triangle with two equal-length sides in geometry.It is sometimes stated as having exactly two equal-length sides and other times as having at least two equal-length sides, with the latter containing …<\/p>\n
\nIsosceles triangle :<\/strong><\/p>\nGiven length of first side = 5\r\nGiven length of second side = 9<\/pre>\n
The Given Isosceles Triangle area with sides [ 5 , 9 ]= 9.808<\/pre>\n
Given length of first side = 12\r\nGiven length of second side = 17.2<\/pre>\n
The Given Isosceles Triangle area with sides [ 12 , 17.2 ]= 71.973<\/pre>\n
Program to Find Isosceles Triangle Area<\/h2>\n
\n
Method #1: Using Mathematical Formula (Static Input)<\/h3>\n
\n
# Import math module using the import keyword.\r\nimport math\r\n# Give the length of the first side of an isosceles triangle as static input\r\n# and store it in a variable.\r\nfst_side = 5\r\n# Give the length of the second side of an isosceles triangle as static input\r\n# and store it in another variable.\r\nsecnd_side = 9\r\n# Calculate the length of the given isosceles triangle using math.sqrt() function\r\n# and the above given mathematical formula.\r\n# Store it in another variable.\r\narea_isosce_tringl = (\r\n secnd_side * math.sqrt((4 * fst_side * fst_side) - (secnd_side * secnd_side)))\/4\r\n# Print the area of the given isosceles triangle.\r\nprint(\"The Given Isosceles Triangle area with sides [\",\r\n fst_side, \",\", secnd_side, \"]= %.3f\" % area_isosce_tringl)\r\n<\/pre>\n
The Given Isosceles Triangle area with sides [ 5 , 9 ]= 9.808<\/pre>\n
Method #2: Using Mathematical Formula (User Input)<\/h3>\n
\n
# Import math module using the import keyword.\r\nimport math\r\n# Give the length of the first side of an isosceles triangle as user input using the float(input()) \r\n#function and store it in a variable.\r\nfst_side = float(input(\"Enter some random number = \"))\r\n# Give the length of the second side of an isosceles triangle as user input using the float(input())\r\n#function and store it in another variable.\r\nsecnd_side = float(input(\"Enter some random number = \"))\r\n# Calculate the length of the given isosceles triangle using math.sqrt() function\r\n# and the above given mathematical formula.\r\n# Store it in another variable.\r\narea_isosce_tringl = (\r\n secnd_side * math.sqrt((4 * fst_side * fst_side) - (secnd_side * secnd_side)))\/4\r\n# Print the area of the given isosceles triangle.\r\nprint(\"The Given Isosceles Triangle area with sides [\",\r\n fst_side, \",\", secnd_side, \"]= %.3f\" % area_isosce_tringl)\r\n<\/pre>\n
Enter some random number = 15\r\nEnter some random number = 22.5\r\nThe Given Isosceles Triangle area with sides [ 15.0 , 22.5 ]= 111.618<\/pre>\n
\n