Question 1
Which of the following will be the value of the variable y?
I agree with the suggested answer C. The code correctly traverses a nested Python dictionary and list structure using standard indexing to reach the integer value 6.
Reason
In the variable x, the key 'b' points to the list [[5, 6], 7]. The expression x['b'][0] accesses the first element of that list, which is another list: [5, 6]. Finally, x['b'][0][1] accesses the element at index 1 of that inner list, which is 6.
Why the other options are not as suitable
- Option A is incorrect because 7 is located at x['b'][1].
- Option B is incorrect because all indices used (0 and 1) exist within their respective lists, so no IndexError is raised.
- Option D is incorrect because 'b' is a valid key in the dictionary x, so no KeyError occurs.




