MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __getitem__

Method __getitem__

matrix/sherman_morrison.py:75–85  ·  view source on GitHub ↗

Return array[row][column] where loc = (row, column). Example: >>> a = Matrix(3, 2, 7) >>> a[1, 0] 7

(self, loc: tuple[int, int])

Source from the content-addressed store, hash-verified

73 return True
74
75 def __getitem__(self, loc: tuple[int, int]) -> Any:
76 """
77 <method Matrix.__getitem__>
78 Return array[row][column] where loc = (row, column).
79 Example:
80 >>> a = Matrix(3, 2, 7)
81 >>> a[1, 0]
82 7
83 """
84 assert self.validate_indices(loc)
85 return self.array[loc[0]][loc[1]]
86
87 def __setitem__(self, loc: tuple[int, int], value: float) -> None:
88 """

Callers

nothing calls this directly

Calls 1

validate_indicesMethod · 0.95

Tested by

no test coverage detected