Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Polygon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import math


def polysum(n, s):
'''
Input: n - number of sides(should be an integer)
s- length of each sides(can be an intger or a float)

Output: Returns Sum of area and the square of the perimeter of the regular polygon(gives a float)
'''
# Code
def areaOfPolygon(n, s):
#Pi = 3.1428
area = (0.25 * n * s ** 2)/math.tan(math.pi/n)
return area

def perimeterOfPolygon(n, s):
perimeter = n * s
return perimeter
sum = areaOfPolygon(n, s) + (perimeterOfPolygon(n, s) ** 2)
return round(sum, 4)


print(polysum(76, 67))