Single Choice Not Set

QWhat will be the output after the following statements?
x = [1, 2, 3, 4]
print(x[4])

ID: #3976 Python Errors and Exceptions Handling 297 views
Question Info
#3976Q ID
Not SetDifficulty
Python Errors and Exceptions HandlingTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A 4
  • B 3
  • C [1, 2, 3, 4]
  • D IndexError
Correct Answer

Explanation

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Input In [66], in ()
      1 x = [1, 2, 3, 4]
----> 2 print(x[4])

IndexError: list index out of range

Share This Question

Challenge a friend or share with your study group.