Initialize matrix with given size and default value. Example: >>> a = Matrix(2, 3, 1) >>> a Matrix consist of 2 rows and 3 columns [1, 1, 1] [1, 1, 1]
(self, row: int, column: int, default_value: float = 0)
| 10 | """ |
| 11 | |
| 12 | def __init__(self, row: int, column: int, default_value: float = 0) -> None: |
| 13 | """ |
| 14 | <method Matrix.__init__> |
| 15 | Initialize matrix with given size and default value. |
| 16 | Example: |
| 17 | >>> a = Matrix(2, 3, 1) |
| 18 | >>> a |
| 19 | Matrix consist of 2 rows and 3 columns |
| 20 | [1, 1, 1] |
| 21 | [1, 1, 1] |
| 22 | """ |
| 23 | |
| 24 | self.row, self.column = row, column |
| 25 | self.array = [[default_value for _ in range(column)] for _ in range(row)] |
| 26 | |
| 27 | def __str__(self) -> str: |
| 28 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected