(self, row: list[int], position: int | None = None)
| 247 | |
| 248 | # MATRIX MANIPULATION |
| 249 | def add_row(self, row: list[int], position: int | None = None) -> None: |
| 250 | type_error = TypeError("Row must be a list containing all ints and/or floats") |
| 251 | if not isinstance(row, list): |
| 252 | raise type_error |
| 253 | for value in row: |
| 254 | if not isinstance(value, (int, float)): |
| 255 | raise type_error |
| 256 | if len(row) != self.num_columns: |
| 257 | raise ValueError( |
| 258 | "Row must be equal in length to the other rows in the matrix" |
| 259 | ) |
| 260 | if position is None: |
| 261 | self.rows.append(row) |
| 262 | else: |
| 263 | self.rows = [*self.rows[0:position], row, *self.rows[position:]] |
| 264 | |
| 265 | def add_column(self, column: list[int], position: int | None = None) -> None: |
| 266 | type_error = TypeError( |
no test coverage detected