mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
psf/black code formatting (#1277)
This commit is contained in:

committed by
Christian Clauss

parent
07f04a2e55
commit
9eac17a408
@ -311,8 +311,10 @@ class Matrix:
|
||||
return Matrix([[element * other for element in row] for row in self.rows])
|
||||
elif isinstance(other, Matrix):
|
||||
if self.num_columns != other.num_rows:
|
||||
raise ValueError("The number of columns in the first matrix must "
|
||||
"be equal to the number of rows in the second")
|
||||
raise ValueError(
|
||||
"The number of columns in the first matrix must "
|
||||
"be equal to the number of rows in the second"
|
||||
)
|
||||
return Matrix(
|
||||
[
|
||||
[Matrix.dot_product(row, column) for column in other.columns()]
|
||||
@ -320,7 +322,9 @@ class Matrix:
|
||||
]
|
||||
)
|
||||
else:
|
||||
raise TypeError("A Matrix can only be multiplied by an int, float, or another matrix")
|
||||
raise TypeError(
|
||||
"A Matrix can only be multiplied by an int, float, or another matrix"
|
||||
)
|
||||
|
||||
def __pow__(self, other):
|
||||
if not isinstance(other, int):
|
||||
|
Reference in New Issue
Block a user