MCQ Single Best Answer Not Set

QWhat type of error is returned by following code :
a=("Amit", "Sumit","Ashish","Sumanta")
print(a.index("Suman"))

ID: #3702 Python Tuple MCQ 317 views
Question Info
#3702Q ID
Not SetDifficulty
Python Tuple MCQTopic

Choose the Best Option

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

  • A SyntaxError
  • B ValueError
  • C TypeError
  • D NameError
Correct Answer: Option B

Explanation

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Input In [33], in ()
      1 a=("Amit", "Sumit","Ashish","Sumanta")
----> 2 print(a.index("Suman"))

ValueError: tuple.index(x): x not in tuple

Share This Question

Challenge a friend or share with your study group.