diff --git a/mathgenerator/algebra.py b/mathgenerator/algebra.py index c6f299a..ed56d5a 100644 --- a/mathgenerator/algebra.py +++ b/mathgenerator/algebra.py @@ -158,7 +158,8 @@ def distance_two_points(max_val_xy=20, min_val_xy=-20): | --- | --- | | Find the distance between $(-19, -6)$ and $(15, -16)$ | $\sqrt{1256}$ | """ - if max_val_xy < min_val_xy: max_val_xy, min_val_xy = min_val_xy, max_val_xy + if max_val_xy < min_val_xy: + max_val_xy, min_val_xy = min_val_xy, max_val_xy point1X = random.randint(min_val_xy, max_val_xy + 1) point1Y = random.randint(min_val_xy, max_val_xy + 1) @@ -503,9 +504,7 @@ def line_equation_from_2_points(max_val=20): y2 = random.randint(-max_val, max_val) m1 = (y2 - y1) // math.gcd(y2 - y1, x2 - x1) m2 = (x2 - x1) // math.gcd(y2 - y1, x2 - x1) - c1 = (y1 * (x2 - x1) - - (y2 - y1) * x1) // math.gcd(y1 * (x2 - x1) - (y2 - y1) * x1, - (x2 - x1)) + c1 = (y1 * (x2 - x1) - (y2 - y1) * x1) // math.gcd(y1 * (x2 - x1) - (y2 - y1) * x1, (x2 - x1)) c2 = (x2 - x1) // math.gcd(y1 * (x2 - x1) - (y2 - y1) * x1, (x2 - x1)) c = rf"{'+' if c1 >= 0 else '-'}\frac{{{abs(c1)}}}{{{c2}}}" if c1 != 0 else "" if c2 < 0: diff --git a/mathgenerator/computer_science.py b/mathgenerator/computer_science.py index b772511..c3a3898 100644 --- a/mathgenerator/computer_science.py +++ b/mathgenerator/computer_science.py @@ -261,9 +261,7 @@ def createTribSeries(i): tribSeries = [] for idx in range(i): if idx not in tribDict: - tribDict[idx] = tribDict[idx - - 1] + tribDict[idx - - 2] + tribDict[idx - 3] + tribDict[idx] = tribDict[idx - 1] + tribDict[idx - 2] + tribDict[idx - 3] tribSeries.append(tribDict[idx]) return tribSeries diff --git a/mathgenerator/misc.py b/mathgenerator/misc.py index d0e1e33..80b6b13 100644 --- a/mathgenerator/misc.py +++ b/mathgenerator/misc.py @@ -220,8 +220,7 @@ def decimal_to_roman_numerals(max_decimal=4000): elif last_value == 4: solution += (roman_dict[div] + roman_dict[div * 5]) elif 5 <= last_value <= 8: - solution += (roman_dict[div * 5] + (roman_dict[div] * - (last_value - 5))) + solution += (roman_dict[div * 5] + (roman_dict[div] * (last_value - 5))) elif last_value == 9: solution += (roman_dict[div] + roman_dict[div * 10]) x = math.floor(x % div)