1

Tadaa! This is my first attempt at writing in Python, trying to solve a good question posed here

```
#-----------------------------------------------------------------------------------------------
#
# Python 2.7
#
# Calculating area and radius of polygons with known number of sides and the length of this side
# Adapted formulas used from this site: http://www.mathwords.com/a/area_regular_polygon.htm
# DM 17/09/2013 first attempt to produce a plusminus decent Python script
#-----------------------------------------------------------------------------------------------
import math
from string import Template
def Calculate_PolygonArea (NumberofSides, SideLength ):
return ( NumberofSides * SideLength ** 2 ) / (4 * math.tan( math.pi / NumberofSides ))
def Calculate_PolygonRadius( NumberofSides, SideLength ):
return SideLength / (2 * math.sin( math.pi / NumberofSides ))
NSides = 100000
SLength = 0.0001
Area = Calculate_PolygonArea( NSides, SLength )
Radius = Calculate_PolygonRadius( NSides, SLength )
StrTmpl = Template('For a polygon with number of sides ${sides} and side length of ${len}')
print ( StrTmpl.safe_substitute( sides=NSides, len=SLength ))
StrTmplResults = Template('Area = ${area} and Radius = ${radius}')
print( StrTmplResults.safe_substitute(area='%.8f' % Area, radius='%.8f' % Radius))
print('Radius is equal to 5.0 / math.pi : ', 5.0 / math.pi )
dummy = input()
```

Any critical comments about my code (good or bad) are accepted with great joy.

And I don't seem to find an answer why the limit seems to diverge to 5/pi.

Anyone to help me out?