From da48b28397f8e5cb23536db66c9a67264b8574b1 Mon Sep 17 00:00:00 2001 From: Anshita Date: Tue, 20 Oct 2020 00:51:54 +0530 Subject: [PATCH] linting improved --- .../funcs/arithmeticProgressionSumFunc.py | 15 ++++++++------- .../funcs/arithmeticProgressionTermFunc.py | 12 ++++++------ mathgenerator/mathgen.py | 12 ++++++------ 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/mathgenerator/funcs/arithmeticProgressionSumFunc.py b/mathgenerator/funcs/arithmeticProgressionSumFunc.py index d7e5589..950f7c1 100644 --- a/mathgenerator/funcs/arithmeticProgressionSumFunc.py +++ b/mathgenerator/funcs/arithmeticProgressionSumFunc.py @@ -1,13 +1,14 @@ from .__init__ import * -def arithmeticProgressionSumFunc (maxd = 100, maxa = 100, maxn = 100): - d = random.randint (-1 * maxd, maxd) - a1 = random.randint (-1 * maxa, maxa) +def arithmeticProgressionSumFunc(maxd=100, maxa=100, maxn=100): + d = random.randint(-1 * maxd, maxd) + a1 = random.randint(-1 * maxa, maxa) a2 = a1 + d a3 = a2 + d - n = random.randint (4, maxn) - apString = str(a1) +', ' + str(a2) +', ' + str(a3) + ' ... ' + n = random.randint(4, maxn) + apString = str(a1) + ', ' + str(a2) + ', ' + str(a3) + ' ... ' problem = 'Find the sum of first ' + str(n) + ' terms of the AP series: ' + apString - solution = n * ((2*a1) + ((n-1)*d))/2 - return problem, solution \ No newline at end of file + solution = n * ((2 * a1) + ((n-1) * d)) / 2 + return problem, solution + \ No newline at end of file diff --git a/mathgenerator/funcs/arithmeticProgressionTermFunc.py b/mathgenerator/funcs/arithmeticProgressionTermFunc.py index 9905b2b..cba850d 100644 --- a/mathgenerator/funcs/arithmeticProgressionTermFunc.py +++ b/mathgenerator/funcs/arithmeticProgressionTermFunc.py @@ -1,13 +1,13 @@ from .__init__ import * -def arithmeticProgressionTermFunc (maxd = 100, maxa = 100, maxn = 100): - d = random.randint (-1 * maxd, maxd) - a1 = random.randint (-1 * maxa, maxa) +def arithmeticProgressionTermFunc(maxd=100, maxa=100, maxn=100): + d = random.randint(-1 * maxd, maxd) + a1 = random.randint(-1 * maxa, maxa) a2 = a1 + d a3 = a2 + d - n = random.randint (4, maxn) - apString = str(a1) +', ' + str(a2) +', ' + str(a3) + ' ... ' + n = random.randint(4, maxn) + apString = str(a1) + ', ' + str(a2) + ', ' + str(a3) + ' ... ' problem = 'Find the term number ' + str(n) + ' of the AP series: ' + apString - solution = a1 + ((n-1)*d) + solution = a1 + ((n-1) * d) return problem, solution diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 1e9b4d7..7df376f 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -269,10 +269,10 @@ percentage = Generator("Percentage of a number", 80, "What is a% of b?", "percentage", percentageFunc) celsiustofahrenheit = Generator("Celsius To Fahrenheit", 81, "(C +(9/5))+32=", "F", celsiustofahrenheitFunc) -arithmeticProgressionTerm = Generator ("AP Term Calculation", 82, - "Find the term number n of the AP series: a1, a2, a3 ..." , - "a-n", arithmeticProgressionTermFunc) +arithmeticProgressionTerm = Generator("AP Term Calculation", 82, + "Find the term number n of the AP series: a1, a2, a3 ...", + "a-n", arithmeticProgressionTermFunc) -arithmeticProgressionSum = Generator ("AP Sum Calculation", 83, - "Find the sum of first n terms of the AP series: a1, a2, a3 ...", - "Sum", arithmeticProgressionSumFunc) +arithmeticProgressionSum = Generator("AP Sum Calculation", 83, + "Find the sum of first n terms of the AP series: a1, a2, a3 ...", + "Sum", arithmeticProgressionSumFunc)