29 lines
733 B
Python
29 lines
733 B
Python
def checkio(matr):
|
|
clone = zip(*matr)
|
|
modifiedClone = []
|
|
for row in clone:
|
|
modifiedClone.append(list(map(mult, row)))
|
|
|
|
for i, row in enumerate(matr):
|
|
for j, cell in enumerate(matr[i]):
|
|
if cell != modifiedClone[i][j]:
|
|
return False
|
|
return True
|
|
|
|
|
|
def mult(e):
|
|
return -1 * e
|
|
|
|
|
|
if __name__ == '__main__':
|
|
assert checkio([[0, 1, 2],
|
|
[-1, 0, 1],
|
|
[-2, -1, 0]]) == True, 'First'
|
|
assert checkio([[0, 1, 2],
|
|
[-1, 1, 1],
|
|
[-2, -1, 0]]) == False, 'Second'
|
|
assert checkio([[0, 1, 2],
|
|
[-1, 0, 1],
|
|
[-3, -1, 0]]) == False, 'Third'
|
|
print('All ok')
|