Commit 0b208e19 by Bertrand NÉRON

### fix python2 syntax

parent 71760b40
 ... ... @@ -3,7 +3,7 @@ Implementation of simple matrix """ def create(row_num, col_num, val = None): def create(row_num, col_num, val=None): """ :param row_num: the number of rows :type row_num: int ... ... @@ -177,8 +177,7 @@ def set_col(matrix, col_no, val): :type val: any """ _check_index(matrix, 0, col_no) row_max, col_max = size(matrix) for row_n in range(im): for row_n in range(matrix): set_cell(matrix, row_n, col_no, val) ... ... @@ -216,8 +215,8 @@ def replace_row(matrix, row_no, row): row_max, col_max = size(matrix) if len(row) != row_max: raise RuntimeError("the size of row {0} does not fit to matrix size {1}x{2}".format(len(row), row_max, col_max)) row_max, col_max)) _check_index(matrix, row_no, 0) for col_no, value in enumerate(row): set_cell(matrix, row_no, col_no, value) ... ... @@ -226,12 +225,12 @@ def replace_row(matrix, row_no, row): if __name__ == '__main__': m = create(5, 3) print m set_cell(m,0, 0, 1) set_cell(m,0, 2, 2) set_cell(m,4, 0, 12) set_cell(m,4, 2, 15) print to_str(m) print "get row 0", get_row(m, 0) print "get col 0", get_col(m, 0) print(m) set_cell(m, 0, 0, 1) set_cell(m, 0, 2, 2) set_cell(m, 4, 0, 12) set_cell(m, 4, 2, 15) print(to_str(m)) print("get row 0", get_row(m, 0)) print("get col 0", get_col(m, 0))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!