You will write functions for the area of a segment. Then you will check the formula in a different way, by counting small squares on a grid.
The idea. The minor segment is the sector minus the triangle . A segment can also be counted: lay a fine grid over the circle and count the grid squares whose centres lie in the segment. The count should agree with the formula.
Your tasks.
minor_segment, return the area of the minor segment for a radius and an angle in degrees, rounded to decimals.major_segment, return the area of the major segment, rounded to decimals.segment_by_grid, return the count of grid squares in the segment times the area of one square, for the grid in the starter.smallest_angle to the smallest whole-degree angle for which the minor segment of a circle of radius has an area of at least .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…