From a865484e9831e3fad6d42d0d73e64cc098b9812c Mon Sep 17 00:00:00 2001 From: deepampriyadarshi Date: Sat, 17 Oct 2020 00:54:33 +0530 Subject: [PATCH 1/2] Added a generator for Simple Intereset --- mathgenerator/mathgen.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 940dd90..bb11dd4 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -586,6 +586,15 @@ def intersectionOfTwoLinesFunc( solution = f"({fractionToString(intersection_x)}, {fractionToString(intersection_y)})" return problem, solution +def simpleInterestFunc(maxPrinciple = 10000, maxRate = 10, maxTime = 10): + a = random.randint(1000, maxPrinciple) + b = random.randint(1, maxRate) + c = random.randint(1, maxTime) + d = (a*b*c)/100 + problem = "Simple interest for a principle amount of " + str(a) +" dollars, " + str(b) + "%% rate of interest and for a time period of " + str(c) + " years is = " + solution = round(d, 2) + return problem, solution + # || Class Instances #Format is: @@ -633,3 +642,4 @@ surfaceAreaConeGen = Generator("Surface Area of cone", 38, "Surface area of cone volumeConeGen = Generator("Volume of cone", 39, "Volume of cone with height = a units and radius = b units is","c units^3", volumeCone) commonFactors = Generator("Common Factors", 40, "Common Factors of {a} and {b} = ","[c, d, ...]",commonFactorsFunc) intersectionOfTwoLines = Generator("Intersection of Two Lines", 41, "Find the point of intersection of the two lines: y = m1*x + b1 and y = m2*x + b2", "(x, y)", intersectionOfTwoLinesFunc) +simpleInterest = Generator("Simple Interest", 42, "Simple interest for a principle amount of a dollars, b%% rate of interest and for a time period of c years is = ", "d dollars", simpleInterestFunc) \ No newline at end of file From 728f29feca252eb2fc2d7a145cfb7330bffc90c1 Mon Sep 17 00:00:00 2001 From: Luke Weiler Date: Fri, 16 Oct 2020 19:19:37 -0400 Subject: [PATCH 2/2] Removed second % symbol in problem --- mathgenerator/mathgen.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index bb11dd4..0a97832 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -591,7 +591,7 @@ def simpleInterestFunc(maxPrinciple = 10000, maxRate = 10, maxTime = 10): b = random.randint(1, maxRate) c = random.randint(1, maxTime) d = (a*b*c)/100 - problem = "Simple interest for a principle amount of " + str(a) +" dollars, " + str(b) + "%% rate of interest and for a time period of " + str(c) + " years is = " + problem = "Simple interest for a principle amount of " + str(a) +" dollars, " + str(b) + "% rate of interest and for a time period of " + str(c) + " years is = " solution = round(d, 2) return problem, solution @@ -642,4 +642,4 @@ surfaceAreaConeGen = Generator("Surface Area of cone", 38, "Surface area of cone volumeConeGen = Generator("Volume of cone", 39, "Volume of cone with height = a units and radius = b units is","c units^3", volumeCone) commonFactors = Generator("Common Factors", 40, "Common Factors of {a} and {b} = ","[c, d, ...]",commonFactorsFunc) intersectionOfTwoLines = Generator("Intersection of Two Lines", 41, "Find the point of intersection of the two lines: y = m1*x + b1 and y = m2*x + b2", "(x, y)", intersectionOfTwoLinesFunc) -simpleInterest = Generator("Simple Interest", 42, "Simple interest for a principle amount of a dollars, b%% rate of interest and for a time period of c years is = ", "d dollars", simpleInterestFunc) \ No newline at end of file +simpleInterest = Generator("Simple Interest", 42, "Simple interest for a principle amount of a dollars, b% rate of interest and for a time period of c years is = ", "d dollars", simpleInterestFunc)