exercism

Exercism solutions.
git clone git://code.dwrz.net/exercism
Log | Files | Refs

matrix.py (443B)


      1 class Matrix:
      2     def __init__(self, matrix_string):
      3         self.matrix = []
      4         for line in matrix_string.strip().split('\n'):
      5             row = []
      6             for v in line.split(" "): row.append(int(v))
      7             self.matrix.append(row)
      8 
      9     def row(self, index):
     10         return self.matrix[index-1]
     11 
     12     def column(self, index):
     13         column = []
     14         for row in self.matrix: column.append(row[index-1])
     15 
     16         return column