Skip to content

ДЗ к 7 уроку#5

Open
getblad wants to merge 1 commit into
masterfrom
lesson7
Open

ДЗ к 7 уроку#5
getblad wants to merge 1 commit into
masterfrom
lesson7

Conversation

@getblad

@getblad getblad commented Sep 19, 2020

Copy link
Copy Markdown
Owner

No description provided.

Comment thread #1.py
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)])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это самое короткое и элегантное решение, что я видел)

Comment thread #1.py
matrix2 = [[1, 2, 3, 5], [1, 2, 3, 4], [1, 2, 2, 7]]
ma = Matrix(matrix)
ma2 = Matrix(matrix2)
c = ma + ma2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше обзывать переменные поинформативнее

Comment thread #3.py
if sub > 0:
return Cell(sub)
else:
print(f'Из клетки {self.get_name()} невозможно вычесть {other.get_name()}', end='')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

да тут прямо можно влупить raise ValueError, чтобы неповадно было

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants