We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent af4fb3a commit de91f66Copy full SHA for de91f66
polysum.py
@@ -0,0 +1,23 @@
1
+import math
2
+
3
4
+def polysum(n, s):
5
+ '''
6
+ Input: n - number of sides(should be an integer)
7
+ s- length of each sides(can be an intger or a float)
8
+ Output: Returns Sum of area and the square of the perimeter of the regular polygon(gives a float)
9
10
+ # Code
11
+ def areaOfPolygon(n, s):
12
+ #Pi = 3.1428
13
+ area = (0.25 * n * s ** 2)/math.tan(math.pi/n)
14
+ return area
15
16
+ def perimeterOfPolygon(n, s):
17
+ perimeter = n * s
18
+ return perimeter
19
+ sum = areaOfPolygon(n, s) + (perimeterOfPolygon(n, s) ** 2)
20
+ return round(sum, 4)
21
22
23
+print(polysum(76, 67))
0 commit comments