mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
lint fixes
This commit is contained in:
@@ -6,8 +6,7 @@ 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)) + "\\)")
|
||||
else:
|
||||
|
||||
@@ -32,14 +32,14 @@ def divideFractionsFunc(maxVal=10, format='string'):
|
||||
if format == 'string':
|
||||
return f"({a}/{b})/({c}/{d})", x
|
||||
elif format == 'latex':
|
||||
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) + "}\\)"
|
||||
return ("\\(\\frac{" + str(a) + "}{" + str(b) + \
|
||||
"}\\div\\frac{" + str(c) + "}{" + str(d) + "}=\\)",
|
||||
solution)
|
||||
return problem, solution
|
||||
else:
|
||||
return a, b, c, d, x
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ def stationaryPointsFunc(maxExp=3, maxCoef=10, format='string'):
|
||||
problem += coefficient * pow(x, exp)
|
||||
solution = sympy.stationary_points(problem, x)
|
||||
|
||||
#if len(solution) != 0:
|
||||
# if len(solution) != 0:
|
||||
solution = ','.join(
|
||||
'({},{})'.format(str(p), sympy.sympify(problem.replace(x, p)))
|
||||
for p in solution)
|
||||
|
||||
@@ -7,8 +7,7 @@ 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 = int((math.pow(golden_ratio, n) - math.pow(-golden_ratio, -n)) / (math.sqrt(5)))
|
||||
|
||||
if format == 'string':
|
||||
solution = f"{ans}"
|
||||
|
||||
@@ -26,8 +26,7 @@ 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)
|
||||
|
||||
Reference in New Issue
Block a user