This commit is contained in:
Xevion
2019-07-13 04:16:23 -05:00
parent f10c9ee99c
commit d558cf2d6c
15 changed files with 90 additions and 1 deletions

11
python/matrix/matrix.py Normal file
View File

@@ -0,0 +1,11 @@
class Matrix(object):
def __init__(self, matrix_string):
self.matrix_string = matrix_string
self.rows = [list(map(int, row.split(' '))) for row in self.matrix_string.split('\n')]
self.columns = [list(column) for column in zip(*(row for row in self.rows))]
def row(self, index):
return self.rows[index - 1]
def column(self, index):
return self.columns[index - 1]