diff --git a/mathgenerator/funcs/basic_math/cube_root.py b/mathgenerator/funcs/basic_math/cube_root.py index d38c84a..34837e7 100644 --- a/mathgenerator/funcs/basic_math/cube_root.py +++ b/mathgenerator/funcs/basic_math/cube_root.py @@ -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: diff --git a/mathgenerator/funcs/basic_math/divide_fractions.py b/mathgenerator/funcs/basic_math/divide_fractions.py index d1d8eb6..d7af59a 100644 --- a/mathgenerator/funcs/basic_math/divide_fractions.py +++ b/mathgenerator/funcs/basic_math/divide_fractions.py @@ -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 diff --git a/mathgenerator/funcs/calculus/stationary_points.py b/mathgenerator/funcs/calculus/stationary_points.py index 726c76a..1132e82 100644 --- a/mathgenerator/funcs/calculus/stationary_points.py +++ b/mathgenerator/funcs/calculus/stationary_points.py @@ -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) diff --git a/mathgenerator/funcs/computer_science/nth_fibonacci_number.py b/mathgenerator/funcs/computer_science/nth_fibonacci_number.py index 80d7ad0..a123a5d 100644 --- a/mathgenerator/funcs/computer_science/nth_fibonacci_number.py +++ b/mathgenerator/funcs/computer_science/nth_fibonacci_number.py @@ -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}" diff --git a/mathgenerator/funcs/misc/decimal_to_roman_numerals.py b/mathgenerator/funcs/misc/decimal_to_roman_numerals.py index 0c238cf..ade0866 100644 --- a/mathgenerator/funcs/misc/decimal_to_roman_numerals.py +++ b/mathgenerator/funcs/misc/decimal_to_roman_numerals.py @@ -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) diff --git a/mathgenerator/funcs/misc/quotient_of_power_same_base.py b/mathgenerator/funcs/misc/quotient_of_power_same_base.py index 3863bfc..ab52586 100644 --- a/mathgenerator/funcs/misc/quotient_of_power_same_base.py +++ b/mathgenerator/funcs/misc/quotient_of_power_same_base.py @@ -10,7 +10,7 @@ def quotientOfPowerSameBaseFunc(maxBase=50, maxPower=10, format='string'): if format == 'string': problem = f"The Quotient of {base}^{power1} and {base}^{power2} = " \ - f"{base}^({power1}-{power2}) = {base}^{step}" + f"{base}^({power1}-{power2}) = {base}^{step}" return problem, str(solution) else: return base, power1, power2, step, solution diff --git a/mathgenerator/funcs/misc/quotient_of_power_same_power.py b/mathgenerator/funcs/misc/quotient_of_power_same_power.py index 5f6ec15..a26c37e 100644 --- a/mathgenerator/funcs/misc/quotient_of_power_same_power.py +++ b/mathgenerator/funcs/misc/quotient_of_power_same_power.py @@ -10,7 +10,7 @@ def quotientOfPowerSamePowerFunc(maxBase=50, maxPower=10, format='string'): if format == 'string': problem = f"The Quotient of {base1}^{power} and {base2}^{power} = " \ - f"({base1}/{base2})^{power} = {step}^{power}" + f"({base1}/{base2})^{power} = {step}^{power}" return problem, str(solution) else: return base1, base2, power, step, solution diff --git a/mathgenerator/funcs/statistics/conditional_probability.py b/mathgenerator/funcs/statistics/conditional_probability.py index 7d184ac..dca1429 100644 --- a/mathgenerator/funcs/statistics/conditional_probability.py +++ b/mathgenerator/funcs/statistics/conditional_probability.py @@ -19,9 +19,9 @@ def conditionalProbFunc(format='string'): if format == 'string': problem = "Someone tested positive for a nasty disease which only {0:.2f}% of population have. " \ - "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) + "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) solution = str(answer) + "%" return problem, solution else: