QuestionQ24

Python Basics

Which of the following is the value of the variable y?

Question Image

  • A 7
  • B y has no value. The following error occurred: IndexError: list index out of range
  • C 6
  • D y has no value. The following error occurred: KeyError: 'b'
Explanation

The key 'b' selects [[5, 6], 7]; indexing with [0] selects [5, 6], and a final [1] selects 6.

Community Discussion

No comments yet. Be the first to start the discussion!