Merge pull request #296 from Metropass/master

Perimeter of Polygons
This commit is contained in:
Luke Weiler
2020-10-21 18:39:18 -04:00
committed by GitHub
2 changed files with 15 additions and 0 deletions

View File

@@ -95,6 +95,7 @@ from .radian_to_deg import *
from .differentiation import * from .differentiation import *
from .definite_integral import * from .definite_integral import *
from .is_prime import * from .is_prime import *
from .perimeter_of_polygons import *
from .bcd_to_decimal import * from .bcd_to_decimal import *
from .complex_to_polar import * from .complex_to_polar import *
from .set_operation import * from .set_operation import *

View File

@@ -0,0 +1,14 @@
from .__init__ import *
from ..__init__ import Generator
def perimeterOfPolygons(maxSides=12, maxLength=120):
size_of_sides = random.randint(3, maxSides)
sides = []
for x in range(size_of_sides):
sides.append(random.randint(1, maxLength))
problem = "The perimeter of a " + str(size_of_sides) + " sided polygon with lengths of " + str(sides) + "cm is: "
solution = 0
for y in range(len(sides)):
solution += sides[y]
return problem, solution