lint fixes

This commit is contained in:
lukew3
2021-02-16 11:27:36 -05:00
parent 6d23628aa0
commit a14a0ad31a
21 changed files with 48 additions and 25 deletions

View File

@@ -72,4 +72,4 @@ intersection_of_two_lines = 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,
["minM=-10","maxM=10","minB=-10","maxB=10","minDenominator=1","maxDenominator=6"])
["minM=-10", "maxM=10", "minB=-10", "maxB=10", "minDenominator=1", "maxDenominator=6"])

View File

@@ -81,4 +81,4 @@ def matrixInversion(SquareMatrixDimension=3,
invert_matrix = Generator("Inverse of a Matrix", 74,
"Inverse of a matrix A is", "A^(-1)",
matrixInversion,
["SquareMatrixDimension=3","MaxMatrixElement=99","OnlyIntegerElementsInInvertedMatrix=False"])
["SquareMatrixDimension=3", "MaxMatrixElement=99", "OnlyIntegerElementsInInvertedMatrix=False"])

View File

@@ -15,4 +15,4 @@ def multiplyComplexNumbersFunc(minRealImaginaryNum=-20,
multiply_complex_numbers = Generator("Multiplication of 2 complex numbers", 65,
"(x + j) (y + j) = ", "xy + xj + yj -1",
multiplyComplexNumbersFunc,
["minRealImaginaryNum=-20","maxRealImaginaryNum=20"])
["minRealImaginaryNum=-20", "maxRealImaginaryNum=20"])

View File

@@ -15,8 +15,10 @@ def multiplyIntToMatrix22(maxMatrixVal=10, maxRes=100, style='raw'):
d1 = d * constant
if style == 'latex':
problem = "\\(" + str(constant) + "\\cdot\\begin{bmatrix}" + str(a) + "&" + str(b) + "\\\\" + str(c) + "&" + str(d) + "\\end{bmatrix}=\\)"
solution = "\\(\\begin{bmatrix}" + str(a1) + "&" + str(b1) + "\\\\" + str(c1) + "&" + str(d1) + "\\end{bmatrix}\\)"
problem = "\\(" + str(constant) + "\\cdot\\begin{bmatrix}" + str(
a) + "&" + str(b) + "\\\\" + str(c) + "&" + str(d) + "\\end{bmatrix}=\\)"
solution = "\\(\\begin{bmatrix}" + str(a1) + "&" + str(b1) + \
"\\\\" + str(c1) + "&" + str(d1) + "\\end{bmatrix}\\)"
else:
problem = f"{constant} * [[{a}, {b}], [{c}, {d}]] = "
solution = f"[[{a1},{b1}],[{c1},{d1}]]"

View File

@@ -20,4 +20,4 @@ def addition_func(maxSum=99, maxAddend=50, style='raw'):
addition = Generator("Addition", 0, "a+b=", "c", addition_func,
["maxSum=99", "maxAddend=50"])
["maxSum=99", "maxAddend=50"])

View File

@@ -17,4 +17,4 @@ def complexDivisionFunc(maxRes=99, maxDivid=99, style='raw'):
complex_division = Generator("Complex Division", 13, "a/b=", "c", complexDivisionFunc,
["maxRes=99", "maxDivid=99"])
["maxRes=99", "maxDivid=99"])

View File

@@ -9,7 +9,8 @@ def cubeRootFunc(minNo=1, maxNo=1000, style='raw'):
problem = f"\\(\\sqrt[3]{{{b}}}=\\)"
solution = "\\(" + str(round(a, 2)) + "\\)"
else:
problem = "What is the cube root of " + str(b) + " up to 2 decimal places?"
problem = "What is the cube root of " + \
str(b) + " up to 2 decimal places?"
solution = str(round(a, 2))
return problem, solution

View File

@@ -30,11 +30,13 @@ def divideFractionsFunc(maxVal=10, style='raw'):
x = f"{sol_numerator}"
if style == 'latex':
problem = "\\(\\frac{" + str(a) + "}{" + str(b) + "}\\div\\frac{" + str(c) + "}{" + str(d) + "}=\\)"
problem = "\\(\\frac{" + str(a) + "}{" + str(b) + \
"}\\div\\frac{" + str(c) + "}{" + str(d) + "}=\\)"
if tmp_d == 1 or tmp_d == gcd:
solution = "\\(" + str(sol_numerator) + "\\)"
else:
solution = "\\(\\frac{" + str(sol_numerator) + "}{" + str(sol_denominator) + "}\\)"
solution = "\\(\\frac{" + str(sol_numerator) + \
"}{" + str(sol_denominator) + "}\\)"
else:
problem = f"({a}/{b})/({c}/{d})"
solution = x

View File

@@ -18,4 +18,5 @@ def divisionToIntFunc(maxA=25, maxB=25, style='raw'):
return problem, solution
division = Generator("Division", 3, "a/b=", "c", divisionToIntFunc, ["maxA=25", "maxB=25"])
division = Generator("Division", 3, "a/b=", "c",
divisionToIntFunc, ["maxA=25", "maxB=25"])

View File

@@ -15,4 +15,5 @@ def factorialFunc(maxInput=6):
return problem, solution
factorial = Generator("Factorial", 31, "a! = ", "b", factorialFunc, ["maxInput=6"])
factorial = Generator("Factorial", 31, "a! = ", "b",
factorialFunc, ["maxInput=6"])

View File

@@ -8,7 +8,8 @@ def powerOfPowersFunc(maxBase=50, maxPower=10, style='raw'):
step = power1 * power2
if style == 'latex':
problem = "Simplify \\(" + str(base) + "^{" + str(power1) + "^{" + str(power2) + "}}\\)"
problem = "Simplify \\(" + str(base) + \
"^{" + str(power1) + "^{" + str(power2) + "}}\\)"
solution = f"\\({base}^{{{step}}}\\)"
else:
problem = f"Simplify {base}^{power1}^{power2}="

View File

@@ -14,4 +14,5 @@ def squareRootFunc(minNo=1, maxNo=12, style='raw'):
return problem, solution
square_root = Generator("Square Root", 6, "sqrt(a)=", "b", squareRootFunc, ["minNo=1", "maxNo=12"])
square_root = Generator("Square Root", 6, "sqrt(a)=",
"b", squareRootFunc, ["minNo=1", "maxNo=12"])

View File

@@ -11,4 +11,5 @@ def subtractionFunc(maxMinuend=99, maxDiff=99):
return problem, solution
subtraction = Generator("Subtraction", 1, "a-b=", "c", subtractionFunc, ["maxMinuend=99", "maxDiff=99"])
subtraction = Generator("Subtraction", 1, "a-b=", "c",
subtractionFunc, ["maxMinuend=99", "maxDiff=99"])

View File

@@ -11,4 +11,4 @@ def areaCircle(maxRadius=100):
area_of_circle = Generator("Area of Circle", 112, "pi*r*r=", "area", areaCircle,
["maxRadius=100"])
["maxRadius=100"])

View File

@@ -29,4 +29,4 @@ def basicTrigonometryFunc(angles=[0, 30, 45, 60, 90],
basic_trigonometry = Generator("Trigonometric Values", 57, "What is sin(X)?",
"ans", basicTrigonometryFunc,
["angles=[0, 30, 45, 60, 90]","functions=['sin', 'cos', 'tan']"])
["angles=[0, 30, 45, 60, 90]", "functions=['sin', 'cos', 'tan']"])

View File

@@ -11,4 +11,4 @@ def circumferenceCircle(maxRadius=100):
circumference = Generator("Circumference", 104, "2*pi*r=", "circumference", circumferenceCircle,
["maxRadius=100"])
["maxRadius=100"])

View File

@@ -8,7 +8,8 @@ def arithmeticProgressionSumFunc(maxd=100, maxa=100, maxn=100):
a3 = a1 + 2 * d
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
problem = 'Find the sum of first ' + \
str(n) + ' terms of the AP series: ' + apString
an = a1 + (n - 1) * d
solution = n * (a1 + an) / 2
return problem, solution

View File

@@ -13,7 +13,8 @@ def set_operation(minval=3, maxval=7, n_a=4, n_b=5):
a = set(a)
b = set(b)
problem = "Given the two sets a=" + \
str(a) + " ,b=" + str(b) + ".Find the Union,intersection,a-b,b-a and symmetric difference"
str(a) + " ,b=" + str(b) + \
".Find the Union,intersection,a-b,b-a and symmetric difference"
solution = "Union is " + str(a.union(b)) + ",Intersection is " + str(
a.intersection(b)) + ", a-b is " + str(
a.difference(b)) + ",b-a is " + str(

View File

@@ -9,7 +9,8 @@ def conditionalProbFunc():
def BayesFormula(P_disease, true_positive, true_negative):
P_notDisease = 100. - P_disease
false_positive = 100. - true_negative
P_plus = (P_disease) * (true_positive) + (P_notDisease) * (false_positive)
P_plus = (P_disease) * (true_positive) + \
(P_notDisease) * (false_positive)
P_disease_plus = ((true_positive) * (100 * P_disease)) / P_plus
return P_disease_plus
@@ -18,7 +19,8 @@ def conditionalProbFunc():
"Test sensitivity (true positive) is equal to SN= {1:.2f}% whereas test specificity (true negative) SP= {2:.2f}%. " \
"What is the probability that this guy really has that disease?".format(
P_disease, true_positive, true_negative)
answer = str(round(BayesFormula(P_disease, true_positive, true_negative), 2)) + "%"
answer = str(
round(BayesFormula(P_disease, true_positive, true_negative), 2)) + "%"
return problem, answer