Calculating the area of a pentagon in Ptyhon3, “a” and “r” length must be known. You see a triangle in the bottom picture. After calculating the area of the triangle, the area of the pentagon can be found by multiplying with 5.
Python3 Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # coding: utf-8 a = input("input the border length? ") r = input("input radius (r): ") area = (5 * (int (a) * int (r) )) / 2 perimeter = 5 * int(a) print ("Pentagon area :"+ str(area)) print ("Pentagon perimeter :"+ str(perimeter)) |
Output:
Online Editor: