MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / __str__

Method __str__

linear_algebra_python/src/lib.py:216–229  ·  view source on GitHub ↗

returns a string representation of this matrix.

(self)

Source from the content-addressed store, hash-verified

214 self.__width = w
215 self.__height = h
216 def __str__(self):
217 """
218 returns a string representation of this
219 matrix.
220 """
221 ans = ""
222 for i in range(self.__height):
223 ans += "|"
224 for j in range(self.__width):
225 if j < self.__width -1:
226 ans += str(self.__matrix[i][j]) + ","
227 else:
228 ans += str(self.__matrix[i][j]) + "|\n"
229 return ans
230 def changeComponent(self,x,y, value):
231 """
232 changes the x-y component of this matrix

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected