Learn Programming and technology with ease @ developerpublish.com

HomePythonPython Program to Find the Area of a Triangle

# Python Program to Find the Area of a Triangle

In this program, we will create a Python program to calculate the area of a triangle. The area of a triangle can be determined using its base and height. By taking user input for the base and height, we will calculate and display the area of the triangle using a simple formula.

## Problem statement

Write a Python program to calculate the area of a triangle using the base and height provided by the user.

## Python Program to Find the Area of a Triangle

# Python Program to Find the Area of a Triangle

# Function to calculate the area of a triangle
def calculate_area(base, height):
area = (base * height) / 2
return area

# Take user input for base and height
base = float(input("Enter the base of the triangle: "))
height = float(input("Enter the height of the triangle: "))

# Calculate and display the area of the triangle
area = calculate_area(base, height)
print("The area of the triangle is:", area)

## Input/Output

### You May Also Like

#### Python Program to Remove Duplicates from a Linked List

In this Python program, we will create a singly linked list and remove duplicate elements from it. A linked list...

#### Python Program to Solve the Celebrity Problem

This Python program solves the Celebrity Problem by finding a person who is known by everyone but does not know...

#### Python Program to Solve n-Queen Problem with Recursion

This Python program uses a recursive approach to solve the n-Queens problem. It explores all possible combinations of queen placements...