MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / change_component

Method change_component

linear_algebra/src/lib.py:145–153  ·  view source on GitHub ↗

input: an index (pos) and a value changes the specified component (pos) with the 'value'

(self, pos: int, value: float)

Source from the content-addressed store, hash-verified

143 raise Exception("index out of range")
144
145 def change_component(self, pos: int, value: float) -> None:
146 """
147 input: an index (pos) and a value
148 changes the specified component (pos) with the
149 'value'
150 """
151 # precondition
152 assert -len(self.__components) <= pos < len(self.__components)
153 self.__components[pos] = value
154
155 def euclidean_length(self) -> float:
156 """

Callers 2

test_change_componentMethod · 0.95
__mul__Method · 0.45

Calls

no outgoing calls

Tested by 1

test_change_componentMethod · 0.76