- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Calculating the area of a triangle is a formula that you can easily implement in python. If you have the base and height of the triangle, you can use the following code to get the area of the triangle,

def get_area(base, height): return 0.5 * base * height print(get_area(10, 15))

This will give the output:

75

If you have the sides of the triangle, you can use herons formula to get the area. For example,

def get_area(a, b, c): s = (a+b+c)/2 return (s*(s-a)*(s-b)*(s-c)) ** 0.5 print(get_area(10, 15, 10))

This will give the output:

49.607837082461074

- Related Questions & Answers
- Java Program to calculate the area of a triangle using Heron's Formula
- Program to calculate area and perimeter of equilateral triangle
- Program to calculate area of Circumcircle of an Equilateral Triangle
- Python Program to calculate the area of a Tetrahedron
- Program to calculate area and perimeter of equilateral triangle in C++
- Program to calculate area of Circumcircle of an Equilateral Triangle in C++
- C++ Program to Compute the Area of a Triangle Using Determinants
- Program to calculate the Area and Perimeter of Incircle of an Equilateral Triangle What is Equilateral Triangle in C?
- Area of Reuleaux Triangle?
- Java program to find the area of a triangle
- Program to calculate the area of a Tetrahedron
- Largest Triangle Area in Python
- Calculating the area of a triangle using its three sides in JavaScript
- Calculate the hypotenuse of a right triangle in JavaScript
- Area of Circumcircle of a Right Angled Triangle?

Advertisements