GIAC
GPYC · Question #1
Which of the following will be the value of the variable y? >>> x = {'a': [1, 2, [3,4]], 'b': [[5, 6], 7]} >>> y = x['b'][0][1]
The correct answer is C. 6. You've hit your limit · resets 1pm (America/New_York)
Python Fundamentals & Command Line Tools
Question
Which of the following will be the value of the variable y?
x = {'a': [1, 2, [3,4]], 'b': [[5, 6], 7]} y = x['b'][0][1]
Options
- A7
- By has no value. The following error occurred: IndexError: list index out of range
- C6
- Dy has no value. The following error occurred: KeyError: 'b'
How the community answered
(50 responses)- A4% (2)
- B2% (1)
- C86% (43)
- D8% (4)
Explanation
You've hit your limit · resets 1pm (America/New_York)
Topics
#nested data structures#dictionary indexing#list indexing#subscript notation
Community Discussion
No community discussion yet for this question.