From 7a510c1f53b9176b5c44fa4271e24d8d00fe5ae8 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Wed, 21 Oct 2020 22:49:08 -0400 Subject: [PATCH] yapf update --- mathgenerator/funcs/angle_btw_vectors.py | 5 ++++- mathgenerator/funcs/complex_quadratic.py | 15 +++++++++------ mathgenerator/funcs/decimal_to_roman_numerals.py | 3 ++- mathgenerator/funcs/nth_fibonacci_number.py | 3 ++- mathgenerator/funcs/perimeter_of_polygons.py | 4 +++- mathgenerator/funcs/power_of_powers.py | 6 +++--- .../funcs/quotient_of_power_same_base.py | 7 ++++--- .../funcs/quotient_of_power_same_power.py | 7 ++++--- 8 files changed, 31 insertions(+), 19 deletions(-) diff --git a/mathgenerator/funcs/angle_btw_vectors.py b/mathgenerator/funcs/angle_btw_vectors.py index cc9923c..054c44b 100644 --- a/mathgenerator/funcs/angle_btw_vectors.py +++ b/mathgenerator/funcs/angle_btw_vectors.py @@ -4,7 +4,10 @@ import math def angleBtwVectorsFunc(maxEltAmt=20): s = 0 - v1 = [round(random.uniform(0, 1000), 2) for i in range(random.randint(2, maxEltAmt))] + v1 = [ + round(random.uniform(0, 1000), 2) + for i in range(random.randint(2, maxEltAmt)) + ] v2 = [round(random.uniform(0, 1000), 2) for i in v1] for i in range(len(v1)): s += v1[i] * v2[i] diff --git a/mathgenerator/funcs/complex_quadratic.py b/mathgenerator/funcs/complex_quadratic.py index c58f915..b2d1292 100644 --- a/mathgenerator/funcs/complex_quadratic.py +++ b/mathgenerator/funcs/complex_quadratic.py @@ -14,7 +14,7 @@ def complexQuadraticFunc(prob_type=0, max_range=10): b = random.randrange(1, max_range) c = random.randrange(1, max_range) - d = (b**2 - 4*a*c) + d = (b**2 - 4 * a * c) else: d = 0 while d >= 0: @@ -22,7 +22,7 @@ def complexQuadraticFunc(prob_type=0, max_range=10): b = random.randrange(1, max_range) c = random.randrange(1, max_range) - d = (b**2 - 4*a*c) + d = (b**2 - 4 * a * c) eq = '' @@ -53,8 +53,8 @@ def complexQuadraticFunc(prob_type=0, max_range=10): return problem, solution else: - s_root1 = round((-b + (d)**0.5)/(2*a), 3) - s_root2 = round((-b - (d)**0.5)/(2*a), 3) + s_root1 = round((-b + (d)**0.5) / (2 * a), 3) + s_root2 = round((-b - (d)**0.5) / (2 * a), 3) sqrt_d = (d)**0.5 @@ -69,5 +69,8 @@ def complexQuadraticFunc(prob_type=0, max_range=10): return problem, solution -complex_quadratic = Generator("complex Quadratic Equation", 100, "Find the roots of given Quadratic Equation ", - "simplified solution : (x1, x2), generalized solution : ((-b + sqrt(d))/2a, (-b - sqrt(d))/2a) or ((-b + sqrt(d)i)/2a, (-b - sqrt(d)i)/2a)", complexQuadraticFunc) +complex_quadratic = Generator( + "complex Quadratic Equation", 100, + "Find the roots of given Quadratic Equation ", + "simplified solution : (x1, x2), generalized solution : ((-b + sqrt(d))/2a, (-b - sqrt(d))/2a) or ((-b + sqrt(d)i)/2a, (-b - sqrt(d)i)/2a)", + complexQuadraticFunc) diff --git a/mathgenerator/funcs/decimal_to_roman_numerals.py b/mathgenerator/funcs/decimal_to_roman_numerals.py index c2470dc..ee66ff6 100644 --- a/mathgenerator/funcs/decimal_to_roman_numerals.py +++ b/mathgenerator/funcs/decimal_to_roman_numerals.py @@ -25,7 +25,8 @@ def decimalToRomanNumeralsFunc(maxDecimal=4000): 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/nth_fibonacci_number.py b/mathgenerator/funcs/nth_fibonacci_number.py index cfb7e8a..3d28655 100644 --- a/mathgenerator/funcs/nth_fibonacci_number.py +++ b/mathgenerator/funcs/nth_fibonacci_number.py @@ -5,7 +5,8 @@ def nthFibonacciNumberFunc(maxN=100): 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))) solution = f"{ans}" return problem, solution diff --git a/mathgenerator/funcs/perimeter_of_polygons.py b/mathgenerator/funcs/perimeter_of_polygons.py index e15402d..5b61688 100644 --- a/mathgenerator/funcs/perimeter_of_polygons.py +++ b/mathgenerator/funcs/perimeter_of_polygons.py @@ -15,4 +15,6 @@ def perimeterOfPolygons(maxSides=12, maxLength=120): perimeter_of_polygons = Generator( - "Perimeter of Polygons", 96, "The perimeter of a x sided polygon with lengths of y cm is: ", "z", perimeterOfPolygons) + "Perimeter of Polygons", 96, + "The perimeter of a x sided polygon with lengths of y cm is: ", "z", + perimeterOfPolygons) diff --git a/mathgenerator/funcs/power_of_powers.py b/mathgenerator/funcs/power_of_powers.py index 5892a57..9381327 100644 --- a/mathgenerator/funcs/power_of_powers.py +++ b/mathgenerator/funcs/power_of_powers.py @@ -12,9 +12,9 @@ def powerOfPowersFunc(maxBase=50, maxPower=10): power1=power1, power2=power2, step=step) - solution = str(base ** step) + solution = str(base**step) return problem, solution -power_of_powers = Generator("Power of Powers", 97, - "6^4^2 = 6^(4*2) = 6^6", "46656", powerOfPowersFunc) +power_of_powers = Generator("Power of Powers", 97, "6^4^2 = 6^(4*2) = 6^6", + "46656", powerOfPowersFunc) diff --git a/mathgenerator/funcs/quotient_of_power_same_base.py b/mathgenerator/funcs/quotient_of_power_same_base.py index 79449d2..cf38296 100644 --- a/mathgenerator/funcs/quotient_of_power_same_base.py +++ b/mathgenerator/funcs/quotient_of_power_same_base.py @@ -12,9 +12,10 @@ def quotientOfPowerSameBaseFunc(maxBase=50, maxPower=10): power1=power1, power2=power2, step=step) - solution = str(base ** step) + solution = str(base**step) return problem, solution -quotient_of_power_same_base = Generator("Quotient of Powers with Same Base", 98, - "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientOfPowerSameBaseFunc) +quotient_of_power_same_base = Generator("Quotient of Powers with Same Base", + 98, "6^4 / 6^2 = 6^(4-2) = 6^2", "36", + quotientOfPowerSameBaseFunc) diff --git a/mathgenerator/funcs/quotient_of_power_same_power.py b/mathgenerator/funcs/quotient_of_power_same_power.py index 0c647db..1c668a8 100644 --- a/mathgenerator/funcs/quotient_of_power_same_power.py +++ b/mathgenerator/funcs/quotient_of_power_same_power.py @@ -12,9 +12,10 @@ def quotientOfPowerSamePowerFunc(maxBase=50, maxPower=10): base2=base2, power=power, step=step) - solution = str(step ** power) + solution = str(step**power) return problem, solution -quotient_of_power_same_power = Generator("Quotient of Powers with Same Power", 99, - "6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientOfPowerSamePowerFunc) +quotient_of_power_same_power = Generator("Quotient of Powers with Same Power", + 99, "6^4 / 3^4 = (6/3)^4 = 2^4", "16", + quotientOfPowerSamePowerFunc)