munch2024 / munch

2 stars 11 forks source link

Task 2.2 Documentation Assistance: Matrix Multiplication Program #95

Closed KeenParchment closed 8 months ago

KeenParchment commented 8 months ago

I have a Python code snippet that performs matrix multiplication. The current program does not have any documentation of the parameters, return values, and error handling.

Goals for documentation:

  1. Explanation of Functionality
  2. Input parameters requirements
  3. Usage Examples
  4. What the function is returning
  5. Error Handling potential errors that may occur

Code Snippet:

def matrix_multiply(matrix_a, matrix_b):
    result = []
    for i in range(len(matrix_a)):
        row = []
        for j in range(len(matrix_b[0])):
            product = 0
            for k in range(len(matrix_b)):
                product += matrix_a[i][k] * matrix_b[k][j]
            row.append(product)
        result.append(row)
    return result