area of triangle in python

Area of a triangle in python full tutorial | Python Bootcamp

Introduction

In this post, you will learn how to calculate the area of a triangle in python and below is the video format of the post, check it out ????????

Video:

Python program to find area of a triangle

To find the area of a triangle then you should use the below formula

First, We calculate the semi perimeter and the formula will be ????????

s = (a + b + c) / 2

Then, We calculate the areas of the triangle ????????

area = (s(s-a)(s-b)*(s-c))

Before getting to the code you need to know about;

  1. Input
  2. Data types
  3. Arithmetic operators

Source code

So, Below is the source code of the area of a triangle and the user should enter the values manually.

Firstly we have added three variables and gave three values for it and then calculated for semi perimeter.

Then finally calculated the area and then print the value.

If you want the user to ask the input value the use the input() function. Below is the source code of that.

Below is a run button that will allow you to run and check the program. I hope now you know how to calculate the area of triangles in python.


Also Read: Square root in python

Also Read: Logical operator in python full tutorial

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions or brave browser to block ads. Please support us by disabling these ads blocker.Our website is made possible by displaying Ads hope you whitelist our site. We use very minimal Ads in our site

 

Scroll to Top