You will write functions for the area of a regular polygon on a circle. Then you will see how many corners are needed before the polygon nearly fills the circle.
The idea. A regular polygon with corners on a circle of radius is made of thin triangles. Each has the area .
Your tasks.
polygon_area, return the area of the regular polygon with n corners on a circle of radius r, rounded to decimals.left_over, return the area of the circle minus the area of the polygon, rounded to decimals.fraction_left, return the left-over area as a fraction of the circle, rounded to decimals.enough to the smallest number of corners n for which the polygon fills at least of the circle.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…