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

Python Program to Find the Area of a Triangle

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this python tutorial, you will learn how to Display Prime Numbers Between Two Intervals using the if and else...
In this python tutorial, you will learn how to Calculate Standard Deviation with built in functions of the python programming...
In this Python program, we will convert temperature values from Celsius to Fahrenheit. The Celsius and Fahrenheit scales are two...