im having some trouble with this Requirements: Write a Python script that prompts the user for the length of a side of a polygon and prints a table of areas of several polygons. Sample output is shown below. Additional requirements: • Your program should use functions to organize the code. Implement these functions: - main The main function should call the function get_side_length and then send side_length to report. - get_side_length This function should prompt the user ("Input the length of a side: ") and return side_length to main as an int. - report This function should print a heading line ("side length...number of sides...area") and use a loop to print a table of values as shown in the sample output below. The report function should call polygon_area to calculate the areas needed for the table. The function report will have to call polygon_area once for each area that it needs to print. - polygon_area This function takes num_sides and side_length as parameters and returns the area of such a polygon. The area of such a polygon is computed by this formula: area = (num_sides * side_length * side_length) \ / (4 * math.tan(math.pi / num_sides))
im having some trouble with this
Requirements:
Write a Python script that prompts the user for the length of a side of a polygon and prints a
table of areas of several polygons. Sample output is shown below.
Additional requirements:
• Your
- main The main function should call the function get_side_length and
then send side_length to report.
- get_side_length This function should prompt the user ("Input the
length of a side: ") and return side_length to main as an int.
- report This function should print a heading line ("side length...number
of sides...area") and use a loop to print a table of values as shown in the
sample output below. The report function should call polygon_area to
calculate the areas needed for the table. The function report will have to call
polygon_area once for each area that it needs to print.
- polygon_area This function takes num_sides and side_length as
parameters and returns the area of such a polygon. The area of such a polygon is
computed by this formula:
area = (num_sides * side_length * side_length) \
/ (4 * math.tan(math.pi / num_sides))
![Skeleton code:
#This program computes
#the area of polygons
import math
def main ():
# Your code goes here
def report( side_length ) :
# Your code goes here
def polygon_area( num_sides, side_length):
# Your code goes here
def get_side_length():
# Your code goes here
#start the program
main ()](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F7da097eb-2b0b-42bf-871b-a33a46200be2%2F427d85e5-b5ea-4254-b838-965df7d25b8e%2F4sgarbo_processed.png&w=3840&q=75)
![Example output:
This program will show the areas
of several different polygons that
have sides of a certain length.
Input the length of a side: 4
side length number of sides
3
4
5
6
7
8
9
area
6.93
16.00
27.53
RESTART
41.57
58.14
77.25
98.91](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F7da097eb-2b0b-42bf-871b-a33a46200be2%2F427d85e5-b5ea-4254-b838-965df7d25b8e%2F1jnj86s_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)