# Programming Examples of Areas in Python: Important Examples

Here are some programming examples of areas in **Python language** to give you an idea of programming works to calculate areas in python and which syntax is used to perform any specific task. Examples will be provided in **sequential order** to get you an easy understanding of the language. So, as usual, first, letâ€™s start by calculating the **area of the circle**.

## Calculating Areas in Python Language

### 1. Area of Circle in Python

radius = int(input("Enter Radius of the Circle: ")) area = 3.14 * radius ** 2 print("Area of Circle: {0: .2f} ".format (area))

**Output:**

Enter Radius of the Circle: 4

Area of Circle: 50.24

### 2. Area of Triangle in Python

b = int(input ("Enter Breadth: ")) h = int(input("Enter Height: ")) area =(b * h) / 2 print("Area of triangle : {0:.2f} ".format (area))

**Output:**

Enter Breadth: 15

Enter Height: 20

Area of triangle : 150.00

### 3. Area of Equilateral Triangle in Python

import math side = int(input("Enter the length of Side: ")) area = (math.sqrt(3) * (side ** 2)) / 4 print("Area of Equilateral triangle: {0: .2f} ".format (area))

**Output:**

Enter the length of Side: 5

Area of Equilateral triangle: 10.83

### 4. Area of Rectangle in Python

len = int (input("Enter length of Rectangle: ")) bre= int(input("Enter breadth of Rectangle: ")) area = len * bre print("Area of Rectangle:", area)

**Output:**

Enter length of Rectangle: 5

Enter breadth of Rectangle: 6

Area of Rectangle: 30

### 5. Area of Square in Python

side = int(input("Enter length of Side: ")) area = side ** 2 print("Area of Square", area)

**Output:**

Enter length of Side: 8

Area of Square 64

### 6. Area of Rhombus in Python

print("Enter values of diagonals: ") d1 = int(input("D1: ")) d2 = int(input( "D2: ")) area = (d1 * d2) / 2 print("Area of Rhombus:", area)

**Output:**

Enter values of diagonals:

D1: 15

D2: 21

Area of Rhombus: 157.5

### 7. Area of Pentagon in Python

from math import sqrt side = int(input("Enter length of Side: ")) area = (sqrt(5 * (5 + 2 * (sqrt(5)))) * side * side) / 4 print("Area of Pentagon {0: .2f} ".format (area))

**Output:**

Enter length of Side: 15

Area of Pentagon 387.11

### 8. Area of Hexagon in Python

from math import sqrt side = int(input("Enter length of Side: ")) area = (3 * sqrt(3) * side * side) / 2 print("Area of Hexagon {0:.2f} ".format (area))

**Output:**

Enter length of Side: 3

Area of Hexagon 23.38

### 9. Area of Heptagon in Python

side = int(input("Enter the value of Side: ")) apo = float(input( "Enter the value of Apothem: ")) peri = 7 * side area = (peri * apo) / 2 print("Area of Heptagon: {0: .2f} ".format(area))

**Output:**

Enter the value of Side: 7

Enter the value of Apothem: 7.4

Area of Heptagon: 181.30

### 10. Area of Regular Octagon in Python

from math import sqrt side = int(input("Enter length of Side: ")) area = 2 * (1 + sqrt(2)) * side ** 2 print("Area of Regular Octagon: {0:.2f} ".format(area))

**Output:**

Enter length of Side: 3

Area of Regular Octagon: 43.46

### 11. Area of Trapezoid in Python

print("Enter values for bases: ") b1 = int(input("B1: ")) b2 = int(input( "B2: ")) h = int(input("Enter height (H): ")) area = ((b1 + b2) *h) / 2 print("Area of Trapezoid", area)

**Output:**

Enter values for bases:

B1: 5

B2: 10

Enter height (H): 14

Area of Trapezoid 105.0

## Conclusion

I hope I have given you all the important programming examples of areas in **Python language.** One important tip for all python beginners, Please take care of indentation!!. Do you agree with me? Please leave a comment. Hope you like the content and the information shared by me. If you find this post knowledgeable and learned something new and interesting today then please share this post with your friends and family members and help the **Optimistic Coder** to spread informational contents. Thank You.