mirror of
https://github.com/Xevion/exercism.git
synced 2025-12-06 15:15:01 -06:00
'init'
This commit is contained in:
11
python/matrix/matrix.py
Normal file
11
python/matrix/matrix.py
Normal 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]
|
||||
Reference in New Issue
Block a user