mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
21 lines
695 B
Python
21 lines
695 B
Python
from .__init__ import *
|
|
|
|
|
|
def distanceTwoPointsFunc(maxValXY=20, minValXY=-20):
|
|
point1X = random.randint(minValXY, maxValXY + 1)
|
|
point1Y = random.randint(minValXY, maxValXY + 1)
|
|
point2X = random.randint(minValXY, maxValXY + 1)
|
|
point2Y = random.randint(minValXY, maxValXY + 1)
|
|
|
|
distanceSq = (point1X - point2X)**2 + (point1Y - point2Y)**2
|
|
|
|
solution = f"sqrt({distanceSq})"
|
|
problem = f"Find the distance between ({point1X}, {point1Y}) and ({point2X}, {point2Y})"
|
|
return problem, solution
|
|
|
|
|
|
distance_two_points = Generator(
|
|
"Distance between 2 points", 24,
|
|
"Find the distance between (x1,y1) and (x2,y2)", "sqrt(distanceSquared)",
|
|
distanceTwoPointsFunc)
|