Single Choice
Not Set
QWhat will be the output after the following statements?
x = [1.0, 2.0, 3.0]
print(x[2.0])
ID: #3978
Python Errors and Exceptions Handling
461 views
Question Info
#3978Q ID
Not SetDifficulty
Python Errors and Exceptions HandlingTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
TypeError
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Input In [68], in| () 1 x = [1.0, 2.0, 3.0] ----> 2 print(x[2.0]) TypeError: list indices must be integers or slices, not float |
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic