main.py
def matrix_sum(a_matrix):
    """Implement the code required to make this function work.

    Write a function `matrix_sum` that sums all the values in a square matrix.
    Example:

    m1 = [
        [2, 9, 1],
        [3, 1, 18],
        [22, 8, 16]
    ]
    m2 = [
      [81, 29],
      [31, 57]
    ]

    matrix_sum(m1)  #  80
    matrix_sum(m2)  # 198
    """
    result = 0
    for row in a_matrix:
        for col in row:
            result += col
        return result
Implement the code required to make this function work.

    Write a function `matrix_sum` that sums all the values in a square matrix.
    Example:

    m1 = [
        [2, 9, 1],
        [3, 1, 18],
        [22, 8, 16]
    ]
    m2 = [
      [81, 29],
      [31, 57]
    ]

    matrix_sum(m1)  #  80
    matrix_sum(m2)  # 198
    
Implement the code required to make this function work.
Write a function `matrix_sum` that sums all the values in a square matrix.
Implement the code required to make this function work . Write a function ` matrix_sum ` that sums all the values in a square matrix .
def matrix_sum(a_matrix):
    result = 0
    for row in a_matrix:
        for col in row:
            result += col
        return result
def matrix_sum ( a_matrix ) : result = 0 for row in a_matrix : for col in row : result += col return result
Implement the code required to make this function work.
Implement the code required to make this function work .
"""Implement the code required to make this function work.

    Write a function `matrix_sum` that sums all the values in a square matrix.
    Example:

    m1 = [
        [2, 9, 1],
        [3, 1, 18],
        [22, 8, 16]
    ]
    m2 = [
      [81, 29],
      [31, 57]
    ]

    matrix_sum(m1)  #  80
    matrix_sum(m2)  # 198
    """
a_matrix
examples
None