Skip to content

Commit 10dfa00

Browse files
authored
black matrix_operation.py
1 parent e292ddb commit 10dfa00

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

matrix/matrix_operation.py

Lines changed: 5 additions & 9 deletions
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)