Question

Given a 2D array (matrix) in Python: matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] What are the values of matrix[1][2] and matrix[2][0] respectively?

A 5 and 7 Correct Answer Incorrect Answer
B 6 and 7 Correct Answer Incorrect Answer
C 4 and 8 Correct Answer Incorrect Answer
D 2 and 9 Correct Answer Incorrect Answer
E 3 and 1 Correct Answer Incorrect Answer

Solution

Correct Answer: B (matrix[1] is [4, 5, 6], so matrix[1][2] is 6. matrix[2] is [7, 8, 9], so matrix[2][0] is 7.)

Practice Next
ask-question