Skip to content

Commit 459f59a

Browse files
cclaussgithub-actionsitsvinayak
authored andcommitted
black matrix_operation.py (TheAlgorithms#2199)
* black matrix_operation.py * updating DIRECTORY.md * Update matrix_operation.py Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: vinayak <[email protected]>
1 parent 93834d7 commit 459f59a

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

DIRECTORY.md

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* [Knight Tour](https://github.com/TheAlgorithms/Python/blob/master/backtracking/knight_tour.py)
2020
* [Minimax](https://github.com/TheAlgorithms/Python/blob/master/backtracking/minimax.py)
2121
* [N Queens](https://github.com/TheAlgorithms/Python/blob/master/backtracking/n_queens.py)
22+
* [N Queens Math](https://github.com/TheAlgorithms/Python/blob/master/backtracking/n_queens_math.py)
2223
* [Rat In Maze](https://github.com/TheAlgorithms/Python/blob/master/backtracking/rat_in_maze.py)
2324
* [Sudoku](https://github.com/TheAlgorithms/Python/blob/master/backtracking/sudoku.py)
2425
* [Sum Of Subsets](https://github.com/TheAlgorithms/Python/blob/master/backtracking/sum_of_subsets.py)
@@ -219,6 +220,9 @@
219220
## Fuzzy Logic
220221
* [Fuzzy Operations](https://github.com/TheAlgorithms/Python/blob/master/fuzzy_logic/fuzzy_operations.py)
221222

223+
## Genetic Algorithm
224+
* [Basic String](https://github.com/TheAlgorithms/Python/blob/master/genetic_algorithm/basic_string.py)
225+
222226
## Geodesy
223227
* [Haversine Distance](https://github.com/TheAlgorithms/Python/blob/master/geodesy/haversine_distance.py)
224228
* [Lamberts Ellipsoidal Distance](https://github.com/TheAlgorithms/Python/blob/master/geodesy/lamberts_ellipsoidal_distance.py)
@@ -293,6 +297,7 @@
293297

294298
## Machine Learning
295299
* [Astar](https://github.com/TheAlgorithms/Python/blob/master/machine_learning/astar.py)
300+
* [Data Transformations](https://github.com/TheAlgorithms/Python/blob/master/machine_learning/data_transformations.py)
296301
* [Decision Tree](https://github.com/TheAlgorithms/Python/blob/master/machine_learning/decision_tree.py)
297302
* [Gaussian Naive Bayes](https://github.com/TheAlgorithms/Python/blob/master/machine_learning/gaussian_naive_bayes.py)
298303
* [Gradient Descent](https://github.com/TheAlgorithms/Python/blob/master/machine_learning/gradient_descent.py)
@@ -402,6 +407,7 @@
402407
* [Square Root](https://github.com/TheAlgorithms/Python/blob/master/maths/square_root.py)
403408
* [Sum Of Arithmetic Series](https://github.com/TheAlgorithms/Python/blob/master/maths/sum_of_arithmetic_series.py)
404409
* [Sum Of Digits](https://github.com/TheAlgorithms/Python/blob/master/maths/sum_of_digits.py)
410+
* [Sum Of Geometric Progression](https://github.com/TheAlgorithms/Python/blob/master/maths/sum_of_geometric_progression.py)
405411
* [Test Prime Check](https://github.com/TheAlgorithms/Python/blob/master/maths/test_prime_check.py)
406412
* [Trapezoidal Rule](https://github.com/TheAlgorithms/Python/blob/master/maths/trapezoidal_rule.py)
407413
* [Volume](https://github.com/TheAlgorithms/Python/blob/master/maths/volume.py)
@@ -680,6 +686,7 @@
680686
* [Crawl Google Results](https://github.com/TheAlgorithms/Python/blob/master/web_programming/crawl_google_results.py)
681687
* [Current Stock Price](https://github.com/TheAlgorithms/Python/blob/master/web_programming/current_stock_price.py)
682688
* [Current Weather](https://github.com/TheAlgorithms/Python/blob/master/web_programming/current_weather.py)
689+
* [Daily Horoscope](https://github.com/TheAlgorithms/Python/blob/master/web_programming/daily_horoscope.py)
683690
* [Emails From Url](https://github.com/TheAlgorithms/Python/blob/master/web_programming/emails_from_url.py)
684691
* [Fetch Bbc News](https://github.com/TheAlgorithms/Python/blob/master/web_programming/fetch_bbc_news.py)
685692
* [Fetch Github Info](https://github.com/TheAlgorithms/Python/blob/master/web_programming/fetch_github_info.py)

matrix/matrix_operation.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ def minor(matrix: List[list], row: int, column: int) -> List[list]:
101101
>>> minor([[1, 2], [3, 4]], 1, 1)
102102
[[1]]
103103
"""
104-
minor = matrix[:row] + matrix[row + 1:]
105-
return [row[:column] + row[column + 1:] for row in minor]
104+
minor = matrix[:row] + matrix[row + 1 :]
105+
return [row[:column] + row[column + 1 :] for row in minor]
106106

107107

108108
def determinant(matrix: List[list]) -> int:
@@ -155,8 +155,7 @@ def _shape(matrix: List[list]) -> list:
155155
return list((len(matrix), len(matrix[0])))
156156

157157

158-
def _verify_matrix_sizes(
159-
matrix_a: List[list], matrix_b: List[list]) -> Tuple[list]:
158+
def _verify_matrix_sizes(matrix_a: List[list], matrix_b: List[list]) -> Tuple[list]:
160159
shape = _shape(matrix_a)
161160
shape += _shape(matrix_b)
162161
if shape[0] != shape[2] or shape[1] != shape[3]:
@@ -170,12 +169,9 @@ def _verify_matrix_sizes(
170169
def main():
171170
matrix_a = [[12, 10], [3, 9]]
172171
matrix_b = [[3, 4], [7, 4]]
173-
matrix_c = [[11, 12, 13, 14], [21, 22, 23, 24],
174-
[31, 32, 33, 34], [41, 42, 43, 44]]
172+
matrix_c = [[11, 12, 13, 14], [21, 22, 23, 24], [31, 32, 33, 34], [41, 42, 43, 44]]
175173
matrix_d = [[3, 0, 2], [2, 0, -2], [0, 1, 1]]
176-
print(
177-
f"Add Operation, {matrix_a} + {matrix_b} ="
178-
f"{add(matrix_a, matrix_b)} \n")
174+
print(f"Add Operation, {matrix_a} + {matrix_b} =" f"{add(matrix_a, matrix_b)} \n")
179175
print(
180176
f"Multiply Operation, {matrix_a} * {matrix_b}",
181177
f"= {multiply(matrix_a, matrix_b)} \n",

0 commit comments

Comments
 (0)