def printsolution(self, x):
        m, n = self.m, self.n
        assert len(x) == m*n
        w = len(str(m*n))
        format = "%" + str(w) + "d"

        squares = [[None] * n for i in range(m)]
        k = 1
        for i in x:
            i1, j1 = self.index2coords(i)
            squares[i1][j1] = k % format
            k += 1

        sep = "+" + ("-" * w + "+") * n
        print sep
        for i in range(m):
            row = squares[i]
            print "|" + "|".join(row) + "|"
            print sep
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_generators.py/Knights.printsolution/swapped operands of `%`