logo CodeStepByStep logo

mystery2d

Language/Type: Python lists multi-dimensional lists

Consider the following function:

def mystery2d(matrix):
    for r in range(len(matrix)):
        for c in range(len(matrix[0]) - 1):
            if matrix[r][c + 1] > matrix[r][c]:
                matrix[r][c] = matrix[r][c + 1]

If a two-dimensional list named numbers is initialized to store the following integers, what are its contents after the call shown?

numbers = [[3, 4, 5, 6], [4, 5, 6, 7], [5, 6, 7, 8]]
mystery2d(numbers)
numbers[0][0]
numbers[0][1]
numbers[0][2]
numbers[0][3]
numbers[1][0]
numbers[1][1]
numbers[1][2]
numbers[1][3]
numbers[2][0]
numbers[2][1]
numbers[2][2]
numbers[2][3]

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.