Conversation
luchanos
reviewed
Sep 20, 2020
| return '' | ||
|
|
||
| def __add__(self, other): | ||
| return Matrix([[i+n for i, n in zip(a, b)] for a, b in zip(self.matrix, other.matrix)]) |
There was a problem hiding this comment.
это самое короткое и элегантное решение, что я видел)
luchanos
reviewed
Sep 20, 2020
| matrix2 = [[1, 2, 3, 5], [1, 2, 3, 4], [1, 2, 2, 7]] | ||
| ma = Matrix(matrix) | ||
| ma2 = Matrix(matrix2) | ||
| c = ma + ma2 |
There was a problem hiding this comment.
лучше обзывать переменные поинформативнее
luchanos
reviewed
Sep 20, 2020
| if sub > 0: | ||
| return Cell(sub) | ||
| else: | ||
| print(f'Из клетки {self.get_name()} невозможно вычесть {other.get_name()}', end='') |
There was a problem hiding this comment.
да тут прямо можно влупить raise ValueError, чтобы неповадно было
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.