Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python Programming Question (Geometry: area of a pentagon) The area of a pentago

ID: 3888297 • Letter: P

Question

Python Programming Question

(Geometry: area of a pentagon) The area of a pentagon can be computed using the following formula (s is the length of a side):

Write a program that prompts the user to enter the side of a pentagon and displays the area. Here is a sample run:

3.4 (Geometry: area of a pentagon) The area of a pentagon can be computed using the following formula (s is the length of a side): Area = 2A 4 × tan Write a program that prompts the user to enter the side of a pentagon and displays the area. Here is a sample run: Enter the side: 5.5 -Enter The area of the pentagon is 53.04444136781625

Explanation / Answer

#import math to use tan and pi
import math

#get user input and convert it float
s = float(input("Enter the side:"))

#calculate area
area = (5*s*s)/(4*math.tan(math.pi/5))

#print area
print("The area of the pentagon is ",area)

"""
sample output

Enter the side: 5.5
The area of the pentagon is 52.04444136781625
"""