input: index (0-indexed) output: the i-th component of the vector.
(self, i: int)
| 133 | return Vector(self.__components) |
| 134 | |
| 135 | def component(self, i: int) -> float: |
| 136 | """ |
| 137 | input: index (0-indexed) |
| 138 | output: the i-th component of the vector. |
| 139 | """ |
| 140 | if isinstance(i, int) and -len(self.__components) <= i < len(self.__components): |
| 141 | return self.__components[i] |
| 142 | else: |
| 143 | raise Exception("index out of range") |
| 144 | |
| 145 | def change_component(self, pos: int, value: float) -> None: |
| 146 | """ |