Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lukew3 committed Jun 2, 2023
1 parent 966419d commit 6e11124
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
7 changes: 3 additions & 4 deletions mathgenerator/algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions mathgenerator/computer_science.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions mathgenerator/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6e11124

Please sign in to comment.