mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
lint fixes
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
from mathgenerator.mathgen import *
|
||||
|
||||
write_list = []
|
||||
subjects = ['algebra', 'basic_math', 'calculus',
|
||||
'computer_science', 'geometry', 'misc', 'statistics']
|
||||
subjects = [
|
||||
'algebra', 'basic_math', 'calculus', 'computer_science', 'geometry',
|
||||
'misc', 'statistics'
|
||||
]
|
||||
wList = getGenList()
|
||||
|
||||
|
||||
@@ -71,12 +73,14 @@ def gen_to_row_string(item):
|
||||
kwargs_list = myGen.kwargs
|
||||
for kwarg in kwargs_list:
|
||||
kwargs += '`' + kwarg + '` '
|
||||
title = '[' + myGen.title + '](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/' + item[4] + '/' + func_name + '.py)'
|
||||
title = '[' + myGen.title + '](https://github.com/lukew3/mathgenerator/blob/main/mathgenerator/funcs/' + item[
|
||||
4] + '/' + func_name + '.py)'
|
||||
row = [myGen.id, title, prob, solu, func_name, kwargs]
|
||||
# tableLine = "| " + str(row[0]) + " | " + str(row[1]) + " | " + str(
|
||||
# row[2]) + " | " + str(row[3]) + " | " + str(row[4]) + " |\n"
|
||||
tableLine = "| " + str(row[0]) + " | " + str(row[1]) + " | " + str(
|
||||
row[2]) + " | " + str(row[3]) + " | " + str(row[4]) + " | " + str(row[5]) + " |\n"
|
||||
row[2]) + " | " + str(row[3]) + " | " + str(row[4]) + " | " + str(
|
||||
row[5]) + " |\n"
|
||||
print('added', item[1], '-', func_name, 'to the README.md')
|
||||
return tableLine
|
||||
|
||||
|
||||
@@ -26,12 +26,10 @@ class Generator:
|
||||
genList.append([id, title, self, funcname, subjectname, kwargs])
|
||||
|
||||
def __str__(self):
|
||||
return str(
|
||||
self.id
|
||||
) + " " + self.title
|
||||
return str(self.id) + " " + self.title
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
return self.func(*args, **kwargs)
|
||||
return self.func(*args, **kwargs)
|
||||
|
||||
|
||||
def getGenList():
|
||||
|
||||
@@ -32,6 +32,5 @@ def basicAlgebraFunc(maxVariable=10, format='string'):
|
||||
return a, b, c, x
|
||||
|
||||
|
||||
|
||||
basic_algebra = Generator("Basic Algebra", 11,
|
||||
basicAlgebraFunc, ["maxVariable=10"])
|
||||
basic_algebra = Generator("Basic Algebra", 11, basicAlgebraFunc,
|
||||
["maxVariable=10"])
|
||||
|
||||
@@ -44,4 +44,5 @@ def combineTerms(string):
|
||||
return final_string
|
||||
|
||||
|
||||
combine_like_terms = Generator("Combine Like terms", 105,likeTermCombineFunc, ["maxCoef=10", "maxExp=20", "maxTerms=10"])
|
||||
combine_like_terms = Generator("Combine Like terms", 105, likeTermCombineFunc,
|
||||
["maxCoef=10", "maxExp=20", "maxTerms=10"])
|
||||
|
||||
@@ -68,7 +68,6 @@ def complexQuadraticFunc(prob_type=0, max_range=10, format='string'):
|
||||
return problem, solution
|
||||
|
||||
|
||||
complex_quadratic = Generator(
|
||||
"complex Quadratic Equation", 100,
|
||||
complexQuadraticFunc,
|
||||
["prob_type=0", "max_range=10"])
|
||||
complex_quadratic = Generator("complex Quadratic Equation", 100,
|
||||
complexQuadraticFunc,
|
||||
["prob_type=0", "max_range=10"])
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
from .__init__ import *
|
||||
|
||||
|
||||
def compoundInterestFunc(maxPrinciple=10000, maxRate=10, maxTime=10, format='string'):
|
||||
def compoundInterestFunc(maxPrinciple=10000,
|
||||
maxRate=10,
|
||||
maxTime=10,
|
||||
format='string'):
|
||||
p = random.randint(1000, maxPrinciple)
|
||||
r = random.randint(1, maxRate)
|
||||
n = random.randint(1, maxTime)
|
||||
@@ -17,6 +20,5 @@ def compoundInterestFunc(maxPrinciple=10000, maxRate=10, maxTime=10, format='str
|
||||
|
||||
|
||||
compound_interest = Generator(
|
||||
"Compound Interest", 78,
|
||||
compoundInterestFunc,
|
||||
"Compound Interest", 78, compoundInterestFunc,
|
||||
["maxPrinciple=10000", "maxRate=10", "maxTime=10"])
|
||||
|
||||
@@ -16,7 +16,7 @@ def distanceTwoPointsFunc(maxValXY=20, minValXY=-20, format='string'):
|
||||
else:
|
||||
return point1X, point1Y, point2X, point2Y, distanceSq
|
||||
|
||||
distance_two_points = Generator(
|
||||
"Distance between 2 points", 24,
|
||||
distanceTwoPointsFunc,
|
||||
["maxValXY=20", "minValXY=-20"])
|
||||
|
||||
distance_two_points = Generator("Distance between 2 points", 24,
|
||||
distanceTwoPointsFunc,
|
||||
["maxValXY=20", "minValXY=-20"])
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
from .__init__ import *
|
||||
|
||||
|
||||
def expandingFunc(range_x1=10, range_x2=10, range_a=10, range_b=10, format='string'):
|
||||
def expandingFunc(range_x1=10,
|
||||
range_x2=10,
|
||||
range_a=10,
|
||||
range_b=10,
|
||||
format='string'):
|
||||
x1 = random.randint(-range_x1, range_x1)
|
||||
x2 = random.randint(-range_x2, range_x2)
|
||||
a = random.randint(-range_a, range_a)
|
||||
@@ -48,5 +52,6 @@ def expandingFunc(range_x1=10, range_x2=10, range_a=10, range_b=10, format='stri
|
||||
return p1, p2, p3, p4, c1, c2, c3
|
||||
|
||||
|
||||
expanding = Generator("Expanding Factored Binomial", 111, expandingFunc,
|
||||
["range_x1=10", "range_x2=10", "range_a=10", "range_b=10"])
|
||||
expanding = Generator(
|
||||
"Expanding Factored Binomial", 111, expandingFunc,
|
||||
["range_x1=10", "range_x2=10", "range_a=10", "range_b=10"])
|
||||
|
||||
@@ -73,5 +73,7 @@ def intersectionOfTwoLinesFunc(minM=-10,
|
||||
|
||||
|
||||
intersection_of_two_lines = Generator(
|
||||
"Intersection of Two Lines", 41, intersectionOfTwoLinesFunc,
|
||||
["minM=-10", "maxM=10", "minB=-10", "maxB=10", "minDenominator=1", "maxDenominator=6"])
|
||||
"Intersection of Two Lines", 41, intersectionOfTwoLinesFunc, [
|
||||
"minM=-10", "maxM=10", "minB=-10", "maxB=10", "minDenominator=1",
|
||||
"maxDenominator=6"
|
||||
])
|
||||
|
||||
@@ -83,6 +83,7 @@ def matrixInversion(SquareMatrixDimension=3,
|
||||
return Mat, sympy.Matrix.inv(Mat)
|
||||
|
||||
|
||||
invert_matrix = Generator("Inverse of a Matrix", 74,
|
||||
matrixInversion,
|
||||
["SquareMatrixDimension=3", "MaxMatrixElement=99", "OnlyIntegerElementsInInvertedMatrix=False"])
|
||||
invert_matrix = Generator("Inverse of a Matrix", 74, matrixInversion, [
|
||||
"SquareMatrixDimension=3", "MaxMatrixElement=99",
|
||||
"OnlyIntegerElementsInInvertedMatrix=False"
|
||||
])
|
||||
|
||||
@@ -19,5 +19,4 @@ def logFunc(maxBase=3, maxVal=8, format='string'):
|
||||
return b, c, a
|
||||
|
||||
|
||||
log = Generator("Logarithm", 12, logFunc,
|
||||
["maxBase=3", "maxVal=8"])
|
||||
log = Generator("Logarithm", 12, logFunc, ["maxBase=3", "maxVal=8"])
|
||||
|
||||
@@ -18,5 +18,4 @@ def MidPointOfTwoPointFunc(maxValue=20, format='string'):
|
||||
|
||||
|
||||
midPoint_of_two_points = Generator("Midpoint of the two point", 20,
|
||||
MidPointOfTwoPointFunc,
|
||||
["maxValue=20"])
|
||||
MidPointOfTwoPointFunc, ["maxValue=20"])
|
||||
|
||||
@@ -17,6 +17,6 @@ def multiplyComplexNumbersFunc(minRealImaginaryNum=-20,
|
||||
return num1, num2, product
|
||||
|
||||
|
||||
multiply_complex_numbers = Generator("Multiplication of 2 complex numbers", 65,
|
||||
multiplyComplexNumbersFunc,
|
||||
["minRealImaginaryNum=-20", "maxRealImaginaryNum=20"])
|
||||
multiply_complex_numbers = Generator(
|
||||
"Multiplication of 2 complex numbers", 65, multiplyComplexNumbersFunc,
|
||||
["minRealImaginaryNum=-20", "maxRealImaginaryNum=20"])
|
||||
|
||||
@@ -20,7 +20,8 @@ def multiplyIntToMatrix22(maxMatrixVal=10, maxRes=100, format='string'):
|
||||
return problem, solution
|
||||
elif style == 'latex':
|
||||
problem = "\\(" + str(constant) + "\\cdot\\begin{bmatrix}" + str(
|
||||
a) + "&" + str(b) + "\\\\" + str(c) + "&" + str(d) + "\\end{bmatrix}=\\)"
|
||||
a) + "&" + str(b) + "\\\\" + str(c) + "&" + str(
|
||||
d) + "\\end{bmatrix}=\\)"
|
||||
solution = "\\(\\begin{bmatrix}" + str(a1) + "&" + str(b1) + \
|
||||
"\\\\" + str(c1) + "&" + str(d1) + "\\end{bmatrix}\\)"
|
||||
return problem, solution
|
||||
|
||||
@@ -11,16 +11,14 @@ def quadraticEquation(maxVal=100, format='string'):
|
||||
D = math.sqrt(b * b - 4 * a * c)
|
||||
res = [round((-b + D) / (2 * a), 2), round((-b - D) / (2 * a), 2)]
|
||||
|
||||
|
||||
if format == 'string':
|
||||
problem = "Zeros of the Quadratic Equation {}x^2+{}x+{}=0".format(a, b, c)
|
||||
problem = "Zeros of the Quadratic Equation {}x^2+{}x+{}=0".format(
|
||||
a, b, c)
|
||||
solution = str(res)
|
||||
return problem, solution
|
||||
else:
|
||||
return a, b, c, res
|
||||
|
||||
|
||||
quadratic_equation = Generator(
|
||||
"Quadratic Equation", 50,
|
||||
quadraticEquation,
|
||||
["maxVal=100"])
|
||||
quadratic_equation = Generator("Quadratic Equation", 50, quadraticEquation,
|
||||
["maxVal=100"])
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
from .__init__ import *
|
||||
|
||||
|
||||
def simpleInterestFunc(maxPrinciple=10000, maxRate=10, maxTime=10, format='string'):
|
||||
def simpleInterestFunc(maxPrinciple=10000,
|
||||
maxRate=10,
|
||||
maxTime=10,
|
||||
format='string'):
|
||||
a = random.randint(1000, maxPrinciple)
|
||||
b = random.randint(1, maxRate)
|
||||
c = random.randint(1, maxTime)
|
||||
@@ -18,6 +21,5 @@ def simpleInterestFunc(maxPrinciple=10000, maxRate=10, maxTime=10, format='strin
|
||||
return a, b, c, d
|
||||
|
||||
|
||||
simple_interest = Generator(
|
||||
"Simple Interest", 45, simpleInterestFunc,
|
||||
["maxPrinciple=10000", "maxRate=10", "maxTime=10"])
|
||||
simple_interest = Generator("Simple Interest", 45, simpleInterestFunc,
|
||||
["maxPrinciple=10000", "maxRate=10", "maxTime=10"])
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
from .__init__ import *
|
||||
|
||||
|
||||
def systemOfEquationsFunc(range_x=10, range_y=10, coeff_mult_range=10, format='string'):
|
||||
def systemOfEquationsFunc(range_x=10,
|
||||
range_y=10,
|
||||
coeff_mult_range=10,
|
||||
format='string'):
|
||||
# Generate solution point first
|
||||
x = random.randint(-range_x, range_x)
|
||||
y = random.randint(-range_y, range_y)
|
||||
@@ -50,6 +53,6 @@ def systemOfEquationsFunc(range_x=10, range_y=10, coeff_mult_range=10, format='s
|
||||
# Add random (non-zero) multiple of equations to each other
|
||||
|
||||
|
||||
system_of_equations = Generator("Solve a System of Equations in R^2", 23,
|
||||
systemOfEquationsFunc,
|
||||
["range_x=10", "range_y=10", "coeff_mult_range=10"])
|
||||
system_of_equations = Generator(
|
||||
"Solve a System of Equations in R^2", 23, systemOfEquationsFunc,
|
||||
["range_x=10", "range_y=10", "coeff_mult_range=10"])
|
||||
|
||||
@@ -17,6 +17,5 @@ def vectorCrossFunc(minVal=-20, maxVal=20, format='string'):
|
||||
return a, b, c
|
||||
|
||||
|
||||
vector_cross = Generator("Cross Product of 2 Vectors", 43,
|
||||
vectorCrossFunc,
|
||||
vector_cross = Generator("Cross Product of 2 Vectors", 43, vectorCrossFunc,
|
||||
["minVal=-20", "maxVal=20"])
|
||||
|
||||
@@ -14,6 +14,5 @@ def vectorDotFunc(minVal=-20, maxVal=20, format='string'):
|
||||
return a, b, c
|
||||
|
||||
|
||||
vector_dot = Generator("Dot Product of 2 Vectors", 72,
|
||||
vectorDotFunc,
|
||||
vector_dot = Generator("Dot Product of 2 Vectors", 72, vectorDotFunc,
|
||||
["minVal=-20", "maxVal=20"])
|
||||
|
||||
@@ -9,13 +9,10 @@ def main(maxA=100, maxB=100, format='string'):
|
||||
if format == "string":
|
||||
return "|" + str(a) + "-" + str(b) + "|=", absDiff
|
||||
elif format == 'latex':
|
||||
return ("\\(|" + str(a) + "-" + str(b) + "|=\\)",
|
||||
f"\\({absDiff}\\)")
|
||||
return ("\\(|" + str(a) + "-" + str(b) + "|=\\)", f"\\({absDiff}\\)")
|
||||
else:
|
||||
return a, b, absDiff
|
||||
|
||||
|
||||
absolute_difference = Generator(
|
||||
"Absolute difference between two numbers", 71,
|
||||
main,
|
||||
["maxA=100", "maxB=100"])
|
||||
absolute_difference = Generator("Absolute difference between two numbers", 71,
|
||||
main, ["maxA=100", "maxB=100"])
|
||||
|
||||
@@ -23,16 +23,16 @@ def compareFractionsFunc(maxVal=10, format='string'):
|
||||
solution = "="
|
||||
|
||||
if format == "string":
|
||||
return (f"Which symbol represents the comparison between {a}/{b} and {c}/{d}?",
|
||||
return (
|
||||
f"Which symbol represents the comparison between {a}/{b} and {c}/{d}?",
|
||||
solution)
|
||||
elif format == 'latex':
|
||||
return (f"Which symbol represents the comparison between \\(\\frac{{{a}}}{{{b}}}\\) and \\(\\frac{{{c}}}{{{d}}}\\)?",
|
||||
return (
|
||||
f"Which symbol represents the comparison between \\(\\frac{{{a}}}{{{b}}}\\) and \\(\\frac{{{c}}}{{{d}}}\\)?",
|
||||
solution)
|
||||
else:
|
||||
return a, b, c, d, solution
|
||||
|
||||
|
||||
compare_fractions = Generator(
|
||||
"Compare Fractions", 44,
|
||||
compareFractionsFunc,
|
||||
["maxVal=10"])
|
||||
compare_fractions = Generator("Compare Fractions", 44, compareFractionsFunc,
|
||||
["maxVal=10"])
|
||||
|
||||
@@ -8,11 +8,10 @@ def complexDivisionFunc(maxRes=99, maxDivid=99, format='string'):
|
||||
c = round(c, 2)
|
||||
|
||||
if format == "string":
|
||||
return (str(a) + "/" + str(b) + "=",
|
||||
str(c))
|
||||
return (str(a) + "/" + str(b) + "=", str(c))
|
||||
elif format == 'latex':
|
||||
return ("\\(" + str(a) + "\\div" + str(b) + "=\\)",
|
||||
"\\(" + str(c) + "\\)")
|
||||
"\\(" + str(c) + "\\)")
|
||||
else:
|
||||
return a, b, c
|
||||
|
||||
|
||||
@@ -6,15 +6,12 @@ def cubeRootFunc(minNo=1, maxNo=1000, format='string'):
|
||||
a = b**(1 / 3)
|
||||
|
||||
if format == 'string':
|
||||
return ("What is the cube root of " + str(b) + " up to 2 decimal places?",
|
||||
str(round(a, 2)))
|
||||
return ("What is the cube root of " + str(b) +
|
||||
" up to 2 decimal places?", str(round(a, 2)))
|
||||
elif format == 'latex':
|
||||
return (f"\\(\\sqrt[3]{{{b}}}=\\)",
|
||||
"\\(" + str(round(a, 2)) + "\\)")
|
||||
return (f"\\(\\sqrt[3]{{{b}}}=\\)", "\\(" + str(round(a, 2)) + "\\)")
|
||||
else:
|
||||
return b, a
|
||||
|
||||
|
||||
cube_root = Generator("Cube Root", 47,
|
||||
cubeRootFunc,
|
||||
["minNo=1", "maxNo=1000"])
|
||||
cube_root = Generator("Cube Root", 47, cubeRootFunc, ["minNo=1", "maxNo=1000"])
|
||||
|
||||
@@ -44,6 +44,5 @@ def divideFractionsFunc(maxVal=10, format='string'):
|
||||
return a, b, c, d, x
|
||||
|
||||
|
||||
divide_fractions = Generator("Fraction Division", 16,
|
||||
divideFractionsFunc,
|
||||
divide_fractions = Generator("Fraction Division", 16, divideFractionsFunc,
|
||||
["maxVal=10"])
|
||||
|
||||
@@ -13,10 +13,9 @@ def divisionToIntFunc(maxA=25, maxB=25, format='string'):
|
||||
return f"{divisor}/{dividend}=", str(quotient)
|
||||
elif format == 'latex':
|
||||
return ("\\(" + str(divisor) + "\\div" + str(dividend) + "=\\)",
|
||||
"\\(" + str(quotient) + "\\)")
|
||||
"\\(" + str(quotient) + "\\)")
|
||||
else:
|
||||
return divisor, dividend, quotient
|
||||
|
||||
|
||||
division = Generator("Division", 3,
|
||||
divisionToIntFunc, ["maxA=25", "maxB=25"])
|
||||
division = Generator("Division", 3, divisionToIntFunc, ["maxA=25", "maxB=25"])
|
||||
|
||||
@@ -6,14 +6,12 @@ def exponentiationFunc(maxBase=20, maxExpo=10, format='string'):
|
||||
expo = random.randint(1, maxExpo)
|
||||
|
||||
if format == 'string':
|
||||
return (f"{base}^{expo} =",
|
||||
str(base**expo))
|
||||
return (f"{base}^{expo} =", str(base**expo))
|
||||
elif format == 'latex':
|
||||
return f"\\({base}^{{{expo}}}\\)", "\\(" + str(base**expo) + "\\)"
|
||||
else:
|
||||
return base, expo, base**expo
|
||||
|
||||
|
||||
exponentiation = Generator("Exponentiation", 53,
|
||||
exponentiationFunc,
|
||||
exponentiation = Generator("Exponentiation", 53, exponentiationFunc,
|
||||
["maxBase=20", "maxExpo=10"])
|
||||
|
||||
@@ -15,5 +15,4 @@ def factorialFunc(maxInput=6, format='string'):
|
||||
return a, b
|
||||
|
||||
|
||||
factorial = Generator("Factorial", 31,
|
||||
factorialFunc, ["maxInput=6"])
|
||||
factorial = Generator("Factorial", 31, factorialFunc, ["maxInput=6"])
|
||||
|
||||
@@ -41,5 +41,4 @@ def multiplyFractionsFunc(maxVal=10, format='string'):
|
||||
|
||||
|
||||
fraction_multiplication = Generator("Fraction Multiplication", 28,
|
||||
multiplyFractionsFunc,
|
||||
["maxVal=10"])
|
||||
multiplyFractionsFunc, ["maxVal=10"])
|
||||
|
||||
@@ -22,6 +22,4 @@ def isprime(max_num=100, format='string'):
|
||||
return a, solution
|
||||
|
||||
|
||||
is_prime = Generator('isprime', 90,
|
||||
isprime,
|
||||
["max_num=100"])
|
||||
is_prime = Generator('isprime', 90, isprime, ["max_num=100"])
|
||||
|
||||
@@ -17,6 +17,5 @@ def multiplicationFunc(maxMulti=12, format='string'):
|
||||
return a, b, c
|
||||
|
||||
|
||||
multiplication = Generator("Multiplication", 2,
|
||||
multiplicationFunc,
|
||||
multiplication = Generator("Multiplication", 2, multiplicationFunc,
|
||||
["maxMulti=12"])
|
||||
|
||||
@@ -18,4 +18,4 @@ def squareRootFunc(minNo=1, maxNo=12, format='string'):
|
||||
|
||||
|
||||
square_root = Generator("Square Root", 6, squareRootFunc,
|
||||
["minNo=1", "maxNo=12"])
|
||||
["minNo=1", "maxNo=12"])
|
||||
|
||||
@@ -15,4 +15,4 @@ def subtractionFunc(maxMinuend=99, maxDiff=99, format='string'):
|
||||
|
||||
|
||||
subtraction = Generator("Subtraction", 1, subtractionFunc,
|
||||
["maxMinuend=99", "maxDiff=99"])
|
||||
["maxMinuend=99", "maxDiff=99"])
|
||||
|
||||
@@ -23,7 +23,5 @@ def definiteIntegralFunc(max_coeff=100, format='string'):
|
||||
return a, b, c, S
|
||||
|
||||
|
||||
definite_integral = Generator(
|
||||
"Definite Integral of Quadratic Equation", 89,
|
||||
definiteIntegralFunc,
|
||||
["max_coeff=100"])
|
||||
definite_integral = Generator("Definite Integral of Quadratic Equation", 89,
|
||||
definiteIntegralFunc, ["max_coeff=100"])
|
||||
|
||||
@@ -51,6 +51,5 @@ def differentiationFunc(diff_lvl=2, format='string'):
|
||||
return problem, solution
|
||||
|
||||
|
||||
differentiation = Generator("Differentiation", 88,
|
||||
differentiationFunc,
|
||||
differentiation = Generator("Differentiation", 88, differentiationFunc,
|
||||
["diff_lvl=2"])
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
from .__init__ import *
|
||||
|
||||
|
||||
def powerRuleDifferentiationFunc(maxCoef=10, maxExp=10, maxTerms=5, format='string'):
|
||||
def powerRuleDifferentiationFunc(maxCoef=10,
|
||||
maxExp=10,
|
||||
maxTerms=5,
|
||||
format='string'):
|
||||
numTerms = random.randint(1, maxTerms)
|
||||
problem = ""
|
||||
solution = ""
|
||||
@@ -22,6 +25,6 @@ def powerRuleDifferentiationFunc(maxCoef=10, maxExp=10, maxTerms=5, format='stri
|
||||
return problem, solution
|
||||
|
||||
|
||||
power_rule_differentiation = Generator("Power Rule Differentiation", 7,
|
||||
powerRuleDifferentiationFunc,
|
||||
["maxCoef=10", "maxExp=10", "maxTerms=5"])
|
||||
power_rule_differentiation = Generator(
|
||||
"Power Rule Differentiation", 7, powerRuleDifferentiationFunc,
|
||||
["maxCoef=10", "maxExp=10", "maxTerms=5"])
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
from .__init__ import *
|
||||
|
||||
|
||||
def powerRuleIntegrationFunc(maxCoef=10, maxExp=10, maxTerms=5, format='string'):
|
||||
def powerRuleIntegrationFunc(maxCoef=10,
|
||||
maxExp=10,
|
||||
maxTerms=5,
|
||||
format='string'):
|
||||
numTerms = random.randint(1, maxTerms)
|
||||
problem = ""
|
||||
solution = ""
|
||||
@@ -26,5 +29,5 @@ def powerRuleIntegrationFunc(maxCoef=10, maxExp=10, maxTerms=5, format='string')
|
||||
|
||||
|
||||
power_rule_integration = Generator("Power Rule Integration", 48,
|
||||
powerRuleIntegrationFunc,
|
||||
powerRuleIntegrationFunc,
|
||||
["maxCoef=10", "maxExp=10", "maxTerms=5"])
|
||||
|
||||
@@ -12,10 +12,9 @@ def stationaryPointsFunc(maxExp=3, maxCoef=10, format='string'):
|
||||
solution = sympy.stationary_points(problem, x)
|
||||
|
||||
#if len(solution) != 0:
|
||||
solution = ','.join('({},{})'.format(
|
||||
str(p),
|
||||
sympy.sympify(problem.replace(x, p))
|
||||
) for p in solution)
|
||||
solution = ','.join(
|
||||
'({},{})'.format(str(p), sympy.sympify(problem.replace(x, p)))
|
||||
for p in solution)
|
||||
problem = 'f(x)=' + str(problem).replace('**', '^')
|
||||
if format == 'string':
|
||||
return problem, solution
|
||||
|
||||
@@ -24,5 +24,4 @@ def BCDtoDecimalFunc(maxNumber=10000, format='string'):
|
||||
|
||||
|
||||
bcd_to_decimal = Generator("Binary Coded Decimal to Integer", 91,
|
||||
BCDtoDecimalFunc,
|
||||
["maxNumber=10000"])
|
||||
BCDtoDecimalFunc, ["maxNumber=10000"])
|
||||
|
||||
@@ -32,5 +32,4 @@ def binary2sComplementFunc(maxDigits=10, format='string'):
|
||||
|
||||
|
||||
binary_2s_complement = Generator("Binary 2's Complement", 73,
|
||||
binary2sComplementFunc,
|
||||
["maxDigits=10"])
|
||||
binary2sComplementFunc, ["maxDigits=10"])
|
||||
|
||||
@@ -18,5 +18,4 @@ def binaryComplement1sFunc(maxDigits=10, format='string'):
|
||||
|
||||
|
||||
binary_complement_1s = Generator("Binary Complement 1s", 4,
|
||||
binaryComplement1sFunc,
|
||||
["maxDigits=10"])
|
||||
binaryComplement1sFunc, ["maxDigits=10"])
|
||||
|
||||
@@ -15,6 +15,5 @@ def binaryToDecimalFunc(max_dig=10, format='string'):
|
||||
return problem, solution
|
||||
|
||||
|
||||
binary_to_decimal = Generator("Binary to Decimal", 15,
|
||||
binaryToDecimalFunc,
|
||||
binary_to_decimal = Generator("Binary to Decimal", 15, binaryToDecimalFunc,
|
||||
["max_dig=10"])
|
||||
|
||||
@@ -17,5 +17,4 @@ def DecimalToBCDFunc(maxNumber=10000, format='string'):
|
||||
|
||||
|
||||
decimal_to_bcd = Generator("Decimal to Binary Coded Decimal", 103,
|
||||
DecimalToBCDFunc,
|
||||
["maxNumber=10000"])
|
||||
DecimalToBCDFunc, ["maxNumber=10000"])
|
||||
|
||||
@@ -11,6 +11,5 @@ def DecimalToBinaryFunc(max_dec=99, format='string'):
|
||||
return problem, solution
|
||||
|
||||
|
||||
decimal_to_binary = Generator("Decimal to Binary", 14,
|
||||
DecimalToBinaryFunc,
|
||||
decimal_to_binary = Generator("Decimal to Binary", 14, DecimalToBinaryFunc,
|
||||
["max_dec=99"])
|
||||
|
||||
@@ -13,5 +13,4 @@ def decimalToOctalFunc(maxDecimal=4096, format='string'):
|
||||
|
||||
|
||||
decimal_to_octal = Generator("Converts decimal to octal", 84,
|
||||
decimalToOctalFunc,
|
||||
["maxDecimal=4096"])
|
||||
decimalToOctalFunc, ["maxDecimal=4096"])
|
||||
|
||||
@@ -17,12 +17,12 @@ def fibonacciSeriesFunc(minNo=1, format='string'):
|
||||
fibList = createFibList(n)
|
||||
|
||||
if format == 'string':
|
||||
problem = "The Fibonacci Series of the first " + str(n) + " numbers is ?"
|
||||
problem = "The Fibonacci Series of the first " + str(
|
||||
n) + " numbers is ?"
|
||||
return problem, fibList
|
||||
else:
|
||||
return n, fibList
|
||||
|
||||
|
||||
fibonacci_series = Generator(
|
||||
"Fibonacci Series", 56, fibonacciSeriesFunc,
|
||||
["minNo=1"])
|
||||
fibonacci_series = Generator("Fibonacci Series", 56, fibonacciSeriesFunc,
|
||||
["minNo=1"])
|
||||
|
||||
@@ -7,7 +7,8 @@ def nthFibonacciNumberFunc(maxN=100, format='string'):
|
||||
golden_ratio = (1 + math.sqrt(5)) / 2
|
||||
n = random.randint(1, maxN)
|
||||
problem = f"What is the {n}th Fibonacci number?"
|
||||
ans = round((math.pow(golden_ratio, n) - math.pow(-golden_ratio, -n)) / (math.sqrt(5)))
|
||||
ans = round((math.pow(golden_ratio, n) - math.pow(-golden_ratio, -n)) /
|
||||
(math.sqrt(5)))
|
||||
|
||||
if format == 'string':
|
||||
solution = f"{ans}"
|
||||
@@ -17,5 +18,4 @@ def nthFibonacciNumberFunc(maxN=100, format='string'):
|
||||
|
||||
|
||||
nth_fibonacci_number = Generator("nth Fibonacci number", 62,
|
||||
nthFibonacciNumberFunc,
|
||||
["maxN=100"])
|
||||
nthFibonacciNumberFunc, ["maxN=100"])
|
||||
|
||||
@@ -25,6 +25,5 @@ def angleBtwVectorsFunc(maxEltAmt=20, format='string'):
|
||||
return problem, solution
|
||||
|
||||
|
||||
angle_btw_vectors = Generator(
|
||||
"Angle between 2 vectors", 70, angleBtwVectorsFunc,
|
||||
["maxEltAmt=20"])
|
||||
angle_btw_vectors = Generator("Angle between 2 vectors", 70,
|
||||
angleBtwVectorsFunc, ["maxEltAmt=20"])
|
||||
|
||||
@@ -14,7 +14,6 @@ def regularPolygonAngleFunc(minVal=3, maxVal=20, format='string'):
|
||||
return sideNum, solution
|
||||
|
||||
|
||||
angle_regular_polygon = Generator(
|
||||
"Angle of a Regular Polygon", 29,
|
||||
regularPolygonAngleFunc,
|
||||
["minVal=3", "maxVal=20"])
|
||||
angle_regular_polygon = Generator("Angle of a Regular Polygon", 29,
|
||||
regularPolygonAngleFunc,
|
||||
["minVal=3", "maxVal=20"])
|
||||
|
||||
@@ -18,6 +18,5 @@ def areaOfTriangleFunc(maxA=20, maxB=20, maxC=20, format='string'):
|
||||
return a, b, c, area
|
||||
|
||||
|
||||
area_of_triangle = Generator("Area of Triangle", 18,
|
||||
areaOfTriangleFunc,
|
||||
area_of_triangle = Generator("Area of Triangle", 18, areaOfTriangleFunc,
|
||||
["maxA=20", "maxB=20", "maxC=20"])
|
||||
|
||||
@@ -5,7 +5,8 @@ import math
|
||||
|
||||
# Handles degrees in quadrant one
|
||||
def basicTrigonometryFunc(angles=[0, 30, 45, 60, 90],
|
||||
functions=["sin", "cos", "tan"], format='string'):
|
||||
functions=["sin", "cos", "tan"],
|
||||
format='string'):
|
||||
angle = random.choice(angles)
|
||||
function = random.choice(functions)
|
||||
|
||||
@@ -31,5 +32,6 @@ def basicTrigonometryFunc(angles=[0, 30, 45, 60, 90],
|
||||
return function, angle, solution
|
||||
|
||||
|
||||
basic_trigonometry = Generator("Trigonometric Values", 57, basicTrigonometryFunc,
|
||||
["angles=[0, 30, 45, 60, 90]", "functions=['sin', 'cos', 'tan']"])
|
||||
basic_trigonometry = Generator(
|
||||
"Trigonometric Values", 57, basicTrigonometryFunc,
|
||||
["angles=[0, 30, 45, 60, 90]", "functions=['sin', 'cos', 'tan']"])
|
||||
|
||||
@@ -15,7 +15,6 @@ def curvedSurfaceAreaCylinderFunc(maxRadius=49, maxHeight=99, format='string'):
|
||||
return r, h, formatted_float
|
||||
|
||||
|
||||
curved_surface_area_cylinder = Generator(
|
||||
"Curved surface area of a cylinder", 95,
|
||||
curvedSurfaceAreaCylinderFunc,
|
||||
["maxRadius=49", "maxHeight=99"])
|
||||
curved_surface_area_cylinder = Generator("Curved surface area of a cylinder",
|
||||
95, curvedSurfaceAreaCylinderFunc,
|
||||
["maxRadius=49", "maxHeight=99"])
|
||||
|
||||
@@ -17,7 +17,6 @@ def fourthAngleOfQuadriFunc(maxAngle=180, format='string'):
|
||||
return angle1, angle2, angle3, angle4
|
||||
|
||||
|
||||
fourth_angle_of_quadrilateral = Generator(
|
||||
"Fourth Angle of Quadrilateral", 49,
|
||||
fourthAngleOfQuadriFunc,
|
||||
["maxAngle=180"])
|
||||
fourth_angle_of_quadrilateral = Generator("Fourth Angle of Quadrilateral", 49,
|
||||
fourthAngleOfQuadriFunc,
|
||||
["maxAngle=180"])
|
||||
|
||||
@@ -18,7 +18,6 @@ def perimeterOfPolygons(maxSides=12, maxLength=120, format='string'):
|
||||
return size_of_sides, sides, solution
|
||||
|
||||
|
||||
perimeter_of_polygons = Generator(
|
||||
"Perimeter of Polygons", 96,
|
||||
perimeterOfPolygons,
|
||||
["maxSides=12", "maxLength=120"])
|
||||
perimeter_of_polygons = Generator("Perimeter of Polygons", 96,
|
||||
perimeterOfPolygons,
|
||||
["maxSides=12", "maxLength=120"])
|
||||
|
||||
@@ -11,9 +11,8 @@ def pythagoreanTheoremFunc(maxLength=20, format='string'):
|
||||
solution = f"{c:.0f}" if c.is_integer() else f"{c:.2f}"
|
||||
return problem, solution
|
||||
else:
|
||||
return a, b, round(c,2)
|
||||
return a, b, round(c, 2)
|
||||
|
||||
|
||||
pythagorean_theorem = Generator(
|
||||
"Pythagorean Theorem", 25, pythagoreanTheoremFunc,
|
||||
["maxLength=20"])
|
||||
pythagorean_theorem = Generator("Pythagorean Theorem", 25,
|
||||
pythagoreanTheoremFunc, ["maxLength=20"])
|
||||
|
||||
@@ -13,5 +13,4 @@ def sumOfAnglesOfPolygonFunc(maxSides=12, format='string'):
|
||||
|
||||
|
||||
sum_of_polygon_angles = Generator("Sum of Angles of Polygon", 58,
|
||||
sumOfAnglesOfPolygonFunc,
|
||||
["maxSides=12"])
|
||||
sumOfAnglesOfPolygonFunc, ["maxSides=12"])
|
||||
|
||||
@@ -16,7 +16,5 @@ def surfaceAreaCone(maxRadius=20, maxHeight=50, unit='m', format='string'):
|
||||
return a, b, ans, unit
|
||||
|
||||
|
||||
surface_area_cone = Generator(
|
||||
"Surface Area of cone", 38,
|
||||
surfaceAreaCone,
|
||||
["maxRadius=20", "maxHeight=50", "unit='m'"])
|
||||
surface_area_cone = Generator("Surface Area of cone", 38, surfaceAreaCone,
|
||||
["maxRadius=20", "maxHeight=50", "unit='m'"])
|
||||
|
||||
@@ -13,6 +13,5 @@ def surfaceAreaCube(maxSide=20, unit='m', format='string'):
|
||||
return a, ans, unit
|
||||
|
||||
|
||||
surface_area_cube = Generator("Surface Area of Cube", 32,
|
||||
surfaceAreaCube,
|
||||
surface_area_cube = Generator("Surface Area of Cube", 32, surfaceAreaCube,
|
||||
["maxSide=20", "unit='m'"])
|
||||
|
||||
@@ -15,7 +15,5 @@ def surfaceAreaCuboid(maxSide=20, unit='m', format='string'):
|
||||
return a, b, c, ans, unit
|
||||
|
||||
|
||||
surface_area_cuboid = Generator(
|
||||
"Surface Area of Cuboid", 33,
|
||||
surfaceAreaCuboid,
|
||||
["maxSide=20", "unit='m'"])
|
||||
surface_area_cuboid = Generator("Surface Area of Cuboid", 33,
|
||||
surfaceAreaCuboid, ["maxSide=20", "unit='m'"])
|
||||
|
||||
@@ -14,7 +14,6 @@ def surfaceAreaCylinder(maxRadius=20, maxHeight=50, unit='m', format='string'):
|
||||
return a, b, ans, unit
|
||||
|
||||
|
||||
surface_area_cylinder = Generator(
|
||||
"Surface Area of Cylinder", 34,
|
||||
surfaceAreaCylinder,
|
||||
["maxRadius=20", "maxHeight=50", "unit='m'"])
|
||||
surface_area_cylinder = Generator("Surface Area of Cylinder", 34,
|
||||
surfaceAreaCylinder,
|
||||
["maxRadius=20", "maxHeight=50", "unit='m'"])
|
||||
|
||||
@@ -13,7 +13,5 @@ def surfaceAreaSphere(maxSide=20, unit='m', format='string'):
|
||||
return r, ans, unit
|
||||
|
||||
|
||||
surface_area_sphere = Generator(
|
||||
"Surface Area of Sphere", 60,
|
||||
surfaceAreaSphere,
|
||||
["maxSide=20", "unit='m'"])
|
||||
surface_area_sphere = Generator("Surface Area of Sphere", 60,
|
||||
surfaceAreaSphere, ["maxSide=20", "unit='m'"])
|
||||
|
||||
@@ -14,5 +14,4 @@ def thirdAngleOfTriangleFunc(maxAngle=89, format='string'):
|
||||
|
||||
|
||||
third_angle_of_triangle = Generator("Third Angle of Triangle", 22,
|
||||
thirdAngleOfTriangleFunc,
|
||||
["maxAngle=89"])
|
||||
thirdAngleOfTriangleFunc, ["maxAngle=89"])
|
||||
|
||||
@@ -23,6 +23,5 @@ def isTriangleValidFunc(maxSideLength=50, format='string'):
|
||||
return sideA, sideB, sideC, exists
|
||||
|
||||
|
||||
valid_triangle = Generator("Triangle exists check", 19,
|
||||
isTriangleValidFunc,
|
||||
valid_triangle = Generator("Triangle exists check", 19, isTriangleValidFunc,
|
||||
["maxSideLength=50"])
|
||||
|
||||
@@ -14,7 +14,5 @@ def volumeCone(maxRadius=20, maxHeight=50, unit='m', format='string'):
|
||||
return a, b, ans, unit
|
||||
|
||||
|
||||
volume_cone = Generator(
|
||||
"Volume of cone", 39,
|
||||
volumeCone,
|
||||
["maxRadius=20", "maxHeight=50", "unit='m'"])
|
||||
volume_cone = Generator("Volume of cone", 39, volumeCone,
|
||||
["maxRadius=20", "maxHeight=50", "unit='m'"])
|
||||
|
||||
@@ -3,7 +3,7 @@ from .__init__ import *
|
||||
|
||||
def volumeCube(maxSide=20, unit='m', format='string'):
|
||||
a = random.randint(1, maxSide)
|
||||
ans = a ** 3
|
||||
ans = a**3
|
||||
|
||||
if format == 'string':
|
||||
problem = f"Volume of cube with side = {a}{unit} is"
|
||||
@@ -13,6 +13,5 @@ def volumeCube(maxSide=20, unit='m', format='string'):
|
||||
return a, ans, unit
|
||||
|
||||
|
||||
volume_cube = Generator("Volum of Cube", 35,
|
||||
volumeCube,
|
||||
volume_cube = Generator("Volum of Cube", 35, volumeCube,
|
||||
["maxSide=20", "unit='m'"])
|
||||
|
||||
@@ -15,7 +15,5 @@ def volumeCuboid(maxSide=20, unit='m', format='string'):
|
||||
return a, b, c, ans, unit
|
||||
|
||||
|
||||
volume_cuboid = Generator(
|
||||
"Volume of Cuboid", 36,
|
||||
volumeCuboid,
|
||||
["maxSide=20", "unit='m'"])
|
||||
volume_cuboid = Generator("Volume of Cuboid", 36, volumeCuboid,
|
||||
["maxSide=20", "unit='m'"])
|
||||
|
||||
@@ -14,7 +14,5 @@ def volumeCylinder(maxRadius=20, maxHeight=50, unit='m', format='string'):
|
||||
return a, b, ans, unit
|
||||
|
||||
|
||||
volume_cylinder = Generator(
|
||||
"Volume of cylinder", 37,
|
||||
volumeCylinder,
|
||||
["maxRadius=20", "maxHeight=50", "unit='m'"])
|
||||
volume_cylinder = Generator("Volume of cylinder", 37, volumeCylinder,
|
||||
["maxRadius=20", "maxHeight=50", "unit='m'"])
|
||||
|
||||
@@ -3,7 +3,7 @@ from .__init__ import *
|
||||
|
||||
def volumeSphereFunc(maxRadius=100, format='string'):
|
||||
r = random.randint(1, maxRadius)
|
||||
ans = (4 * math.pi / 3) * r ** 3
|
||||
ans = (4 * math.pi / 3) * r**3
|
||||
|
||||
if format == 'string':
|
||||
problem = f"Volume of sphere with radius {r} m = "
|
||||
@@ -13,6 +13,5 @@ def volumeSphereFunc(maxRadius=100, format='string'):
|
||||
return r, ans
|
||||
|
||||
|
||||
volume_sphere = Generator("Volume of Sphere", 61,
|
||||
volumeSphereFunc,
|
||||
volume_sphere = Generator("Volume of Sphere", 61, volumeSphereFunc,
|
||||
["maxRadius=100"])
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
from .__init__ import *
|
||||
|
||||
|
||||
def arithmeticProgressionSumFunc(maxd=100, maxa=100, maxn=100, format='string'):
|
||||
def arithmeticProgressionSumFunc(maxd=100,
|
||||
maxa=100,
|
||||
maxn=100,
|
||||
format='string'):
|
||||
d = random.randint(-1 * maxd, maxd)
|
||||
a1 = random.randint(-1 * maxa, maxa)
|
||||
a2 = a1 + d
|
||||
@@ -11,7 +14,6 @@ def arithmeticProgressionSumFunc(maxd=100, maxa=100, maxn=100, format='string'):
|
||||
an = a1 + (n - 1) * d
|
||||
solution = n * (a1 + an) / 2
|
||||
|
||||
|
||||
if format == 'string':
|
||||
problem = 'Find the sum of first ' + \
|
||||
str(n) + ' terms of the AP series: ' + apString
|
||||
@@ -20,7 +22,6 @@ def arithmeticProgressionSumFunc(maxd=100, maxa=100, maxn=100, format='string'):
|
||||
return n, apString, solution
|
||||
|
||||
|
||||
arithmetic_progression_sum = Generator(
|
||||
"AP Sum Calculation", 83,
|
||||
arithmeticProgressionSumFunc,
|
||||
["maxd=100", "maxa=100", "maxn=100"])
|
||||
arithmetic_progression_sum = Generator("AP Sum Calculation", 83,
|
||||
arithmeticProgressionSumFunc,
|
||||
["maxd=100", "maxa=100", "maxn=100"])
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
from .__init__ import *
|
||||
|
||||
|
||||
def arithmeticProgressionTermFunc(maxd=100, maxa=100, maxn=100, format='string'):
|
||||
def arithmeticProgressionTermFunc(maxd=100,
|
||||
maxa=100,
|
||||
maxn=100,
|
||||
format='string'):
|
||||
d = random.randint(-1 * maxd, maxd)
|
||||
a1 = random.randint(-1 * maxa, maxa)
|
||||
a2 = a1 + d
|
||||
@@ -18,7 +21,6 @@ def arithmeticProgressionTermFunc(maxd=100, maxa=100, maxn=100, format='string')
|
||||
return n, apString, solution
|
||||
|
||||
|
||||
arithmetic_progression_term = Generator(
|
||||
"AP Term Calculation", 82,
|
||||
arithmeticProgressionTermFunc,
|
||||
["maxd=100", "maxa=100", "maxn=100"])
|
||||
arithmetic_progression_term = Generator("AP Term Calculation", 82,
|
||||
arithmeticProgressionTermFunc,
|
||||
["maxd=100", "maxa=100", "maxn=100"])
|
||||
|
||||
@@ -53,9 +53,9 @@ def baseConversionFunc(maxNum=60000, maxBase=16, format='string'):
|
||||
ans = fromBaseTenTo(n, bases[1])
|
||||
return problem, ans
|
||||
else:
|
||||
return fromBaseTenTo(n, bases[0]), bases[0], bases[1], fromBaseTenTo(n, bases[1])
|
||||
return fromBaseTenTo(n, bases[0]), bases[0], bases[1], fromBaseTenTo(
|
||||
n, bases[1])
|
||||
|
||||
|
||||
base_conversion = Generator("Base Conversion", 94,
|
||||
baseConversionFunc,
|
||||
base_conversion = Generator("Base Conversion", 94, baseConversionFunc,
|
||||
["maxNum=60000", "maxBase=16"])
|
||||
|
||||
@@ -15,5 +15,4 @@ def celsiustofahrenheitFunc(maxTemp=100, format='string'):
|
||||
|
||||
|
||||
celsius_to_fahrenheit = Generator("Celsius To Fahrenheit", 81,
|
||||
celsiustofahrenheitFunc,
|
||||
["maxTemp=100"])
|
||||
celsiustofahrenheitFunc, ["maxTemp=100"])
|
||||
|
||||
@@ -27,6 +27,5 @@ def commonFactorsFunc(maxVal=100, format='string'):
|
||||
return a, b, arr
|
||||
|
||||
|
||||
common_factors = Generator("Common Factors", 40,
|
||||
commonFactorsFunc,
|
||||
common_factors = Generator("Common Factors", 40, commonFactorsFunc,
|
||||
["maxVal=100"])
|
||||
|
||||
@@ -3,7 +3,9 @@ from .__init__ import *
|
||||
import math
|
||||
|
||||
|
||||
def complexToPolarFunc(minRealImaginaryNum=-20, maxRealImaginaryNum=20, format='string'):
|
||||
def complexToPolarFunc(minRealImaginaryNum=-20,
|
||||
maxRealImaginaryNum=20,
|
||||
format='string'):
|
||||
num = complex(random.randint(minRealImaginaryNum, maxRealImaginaryNum),
|
||||
random.randint(minRealImaginaryNum, maxRealImaginaryNum))
|
||||
a = num.real
|
||||
@@ -18,5 +20,6 @@ def complexToPolarFunc(minRealImaginaryNum=-20, maxRealImaginaryNum=20, format='
|
||||
return r, a, b, theta
|
||||
|
||||
|
||||
complex_to_polar = Generator("Complex To Polar Form", 92, complexToPolarFunc,
|
||||
["minRealImaginaryNum=-20, maxRealImaginaryNum=20"])
|
||||
complex_to_polar = Generator(
|
||||
"Complex To Polar Form", 92, complexToPolarFunc,
|
||||
["minRealImaginaryNum=-20, maxRealImaginaryNum=20"])
|
||||
|
||||
@@ -26,7 +26,8 @@ def decimalToRomanNumeralsFunc(maxDecimal=4000, format='string'):
|
||||
elif last_value == 4:
|
||||
solution += (roman_dict[divisor] + roman_dict[divisor * 5])
|
||||
elif 5 <= last_value <= 8:
|
||||
solution += (roman_dict[divisor * 5] + (roman_dict[divisor] * (last_value - 5)))
|
||||
solution += (roman_dict[divisor * 5] + (roman_dict[divisor] *
|
||||
(last_value - 5)))
|
||||
elif last_value == 9:
|
||||
solution += (roman_dict[divisor] + roman_dict[divisor * 10])
|
||||
x = math.floor(x % divisor)
|
||||
|
||||
@@ -16,6 +16,5 @@ def euclidianNormFunc(maxEltAmt=20, format='string'):
|
||||
return vec, solution
|
||||
|
||||
|
||||
eucldian_norm = Generator(
|
||||
"Euclidian norm or L2 norm of a vector", 69, euclidianNormFunc,
|
||||
["maxEltAmt=20"])
|
||||
eucldian_norm = Generator("Euclidian norm or L2 norm of a vector", 69,
|
||||
euclidianNormFunc, ["maxEltAmt=20"])
|
||||
|
||||
@@ -27,6 +27,5 @@ def geometricMeanFunc(maxValue=100, maxNum=4, format='string'):
|
||||
return problem, solution
|
||||
|
||||
|
||||
geometric_mean = Generator(
|
||||
"Geometric Mean of N Numbers", 67, geometricMeanFunc,
|
||||
["maxValue=100", "maxNum=4"])
|
||||
geometric_mean = Generator("Geometric Mean of N Numbers", 67,
|
||||
geometricMeanFunc, ["maxValue=100", "maxNum=4"])
|
||||
|
||||
@@ -20,7 +20,8 @@ def geomProgrFunc(number_values=6,
|
||||
if format == 'string':
|
||||
problem = "For the given GP " + str(
|
||||
GP) + " ,Find the value of a,common ratio," + str(
|
||||
n_term) + "th term value, sum upto " + str(sum_term) + "th term"
|
||||
n_term) + "th term value, sum upto " + str(
|
||||
sum_term) + "th term"
|
||||
solution = "The value of a is {}, common ratio is {} , {}th term is {} , sum upto {}th term is {}".format(
|
||||
a, r, n_term, value_nth_term, sum_term, sum_till_nth_term)
|
||||
return problem, solution
|
||||
@@ -28,7 +29,6 @@ def geomProgrFunc(number_values=6,
|
||||
return GP, n_term, sum_term, a, r, n_term, value_nth_term, sum_term, sum_till_nth_term
|
||||
|
||||
|
||||
|
||||
geometric_progression = Generator(
|
||||
"Geometric Progression", 66, geomProgrFunc,
|
||||
["number_values=6", "min_value=2", "max_value=12", "n_term=7", "sum_term=5"])
|
||||
geometric_progression = Generator("Geometric Progression", 66, geomProgrFunc, [
|
||||
"number_values=6", "min_value=2", "max_value=12", "n_term=7", "sum_term=5"
|
||||
])
|
||||
|
||||
@@ -28,6 +28,5 @@ def harmonicMeanFunc(maxValue=100, maxNum=4, format='string'):
|
||||
return problem, solution
|
||||
|
||||
|
||||
harmonic_mean = Generator("Harmonic Mean of N Numbers", 68,
|
||||
harmonicMeanFunc,
|
||||
harmonic_mean = Generator("Harmonic Mean of N Numbers", 68, harmonicMeanFunc,
|
||||
["maxValue=100", "maxNum=4"])
|
||||
|
||||
@@ -16,5 +16,4 @@ def hcfFunc(maxVal=20, format='string'):
|
||||
return a, b, x
|
||||
|
||||
|
||||
hcf = Generator("HCF (Highest Common Factor)", 51, hcfFunc,
|
||||
["maxVal=20"])
|
||||
hcf = Generator("HCF (Highest Common Factor)", 51, hcfFunc, ["maxVal=20"])
|
||||
|
||||
@@ -25,6 +25,5 @@ def IsLeapYear(minNumber=1900, maxNumber=2099, format='string'):
|
||||
return year, ans
|
||||
|
||||
|
||||
is_leap_year = Generator("Leap Year or Not", 101,
|
||||
IsLeapYear,
|
||||
is_leap_year = Generator("Leap Year or Not", 101, IsLeapYear,
|
||||
["minNumber=1900", "maxNumber=2099"])
|
||||
|
||||
@@ -19,6 +19,4 @@ def lcmFunc(maxVal=20, format='string'):
|
||||
return a, b, d
|
||||
|
||||
|
||||
lcm = Generator("LCM (Least Common Multiple)", 9,
|
||||
lcmFunc,
|
||||
["maxVal=20"])
|
||||
lcm = Generator("LCM (Least Common Multiple)", 9, lcmFunc, ["maxVal=20"])
|
||||
|
||||
@@ -15,5 +15,4 @@ def minutesToHoursFunc(maxMinutes=999, format='string'):
|
||||
|
||||
|
||||
minutes_to_hours = Generator("Minute to Hour conversion", 102,
|
||||
minutesToHoursFunc,
|
||||
["maxMinutes=999"])
|
||||
minutesToHoursFunc, ["maxMinutes=999"])
|
||||
|
||||
@@ -25,5 +25,5 @@ def primeFactorsFunc(minVal=1, maxVal=200, format='string'):
|
||||
return a, factors
|
||||
|
||||
|
||||
prime_factors = Generator("Prime Factorisation", 27,primeFactorsFunc,
|
||||
prime_factors = Generator("Prime Factorisation", 27, primeFactorsFunc,
|
||||
["minVal=1", "maxVal=200"])
|
||||
|
||||
@@ -18,7 +18,6 @@ def profitLossPercentFunc(maxCP=1000, maxSP=1000, format='string'):
|
||||
return profitOrLoss, cP, sP, percent
|
||||
|
||||
|
||||
profit_loss_percent = Generator(
|
||||
"Profit or Loss Percent", 63,
|
||||
profitLossPercentFunc,
|
||||
["maxCP=1000", "maxSP=1000"])
|
||||
profit_loss_percent = Generator("Profit or Loss Percent", 63,
|
||||
profitLossPercentFunc,
|
||||
["maxCP=1000", "maxSP=1000"])
|
||||
|
||||
@@ -21,6 +21,5 @@ def combinationsFunc(maxlength=20, format='string'):
|
||||
return a, b, solution
|
||||
|
||||
|
||||
combinations = Generator(
|
||||
"Combinations of Objects", 30, combinationsFunc,
|
||||
["maxlength=20"])
|
||||
combinations = Generator("Combinations of Objects", 30, combinationsFunc,
|
||||
["maxlength=20"])
|
||||
|
||||
@@ -28,6 +28,5 @@ def conditionalProbFunc(format='string'):
|
||||
return P_disease, true_positive, true_negative, answer
|
||||
|
||||
|
||||
conditional_probability = Generator("Conditional Probability",
|
||||
107, conditionalProbFunc,
|
||||
[""])
|
||||
conditional_probability = Generator("Conditional Probability", 107,
|
||||
conditionalProbFunc, [""])
|
||||
|
||||
@@ -39,5 +39,4 @@ def confidenceIntervalFunc(format='string'):
|
||||
|
||||
|
||||
confidence_interval = Generator("Confidence interval For sample S", 54,
|
||||
confidenceIntervalFunc,
|
||||
[""])
|
||||
confidenceIntervalFunc, [""])
|
||||
|
||||
@@ -27,5 +27,6 @@ def dataSummaryFunc(number_values=15, minval=5, maxval=50, format='string'):
|
||||
return random_list, mean, standardDeviation, variance
|
||||
|
||||
|
||||
data_summary = Generator("Mean,Standard Deviation,Variance", 59, dataSummaryFunc,
|
||||
data_summary = Generator("Mean,Standard Deviation,Variance", 59,
|
||||
dataSummaryFunc,
|
||||
["number_values=15", "minval=5", "maxval=50"])
|
||||
|
||||
@@ -30,5 +30,4 @@ def DiceSumProbFunc(maxDice=3, format='string'):
|
||||
|
||||
dice_sum_probability = Generator(
|
||||
"Probability of a certain sum appearing on faces of dice", 52,
|
||||
DiceSumProbFunc,
|
||||
["maxDice=3"])
|
||||
DiceSumProbFunc, ["maxDice=3"])
|
||||
|
||||
@@ -19,5 +19,4 @@ def meanMedianFunc(maxlen=10, format='string'):
|
||||
return randomlist, mean, median
|
||||
|
||||
|
||||
mean_median = Generator("Mean and Median", 76, meanMedianFunc,
|
||||
["maxlen=10"])
|
||||
mean_median = Generator("Mean and Median", 76, meanMedianFunc, ["maxlen=10"])
|
||||
|
||||
@@ -16,6 +16,4 @@ def permutationFunc(maxlength=20, format='string'):
|
||||
return a, b, answer
|
||||
|
||||
|
||||
permutation = Generator(
|
||||
"Permutations", 42, permutationFunc,
|
||||
["maxlength=20"])
|
||||
permutation = Generator("Permutations", 42, permutationFunc, ["maxlength=20"])
|
||||
|
||||
Reference in New Issue
Block a user