logo CodeStepByStep logo

list_tracing_2d

Language/Type: Python 2D lists list mystery

What are the values of the elements in the list numbers after the following code is executed?

numbers = [[0, 0, 0, 0],
           [0, 0, 0, 0],
           [0, 0, 0, 0]]
for r in range(len(numbers)): 
    for c in range(len(numbers[0])):
        numbers[r][c] = r + c
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.