# How you can Calculate the realm of an everyday N sides polygon inside a circle of radius R in Python

0
6

## The problem#

Write the next operate:

``````def area_of_polygon_inside_circle(circle_radius, number_of_sides):
``````

It ought to calculate the realm of an everyday polygon of `numberOfSides``number-of-sides`, or `number_of_sides` sides inside a circle of radius `circleRadius``circle-radius`, or `circle_radius` which passes by means of all of the vertices of the polygon (such a circle known as circumscribed circle or circumcircle). The reply must be a quantity rounded to three decimal locations.

Enter/Output Examples

``````area_of_polygon_inside_circle(3, 3) # returns 11.691
area_of_polygon_inside_circle(5.8, 7) # returns 92.053
area_of_polygon_inside_circle(4, 5) # returns 38.042
``````

## The answer in Python code#

Choice 1:

``````from math import sin, pi

def area_of_polygon_inside_circle(r, n):
return spherical(0.5 * n * r ** 2 * sin(2 * pi / n), 3)
``````

Choice 2:

``````import math
s = number_of_sides
a = (s * (r ** 2) * math.sin(2*math.pi/s))/2
return spherical(a, 3)
``````

Choice 3:

``````from math import sin,cos,radians
``````check.describe('Instance Checks')