What is the expected behavior of the following program?
foo = (1, 2, 3) foo.index(0)
- The program will cause a SyntaxError exception.
- The program will output 1 to the screen.
- The program will cause an AttributeError exception.
- The program will cause a TypeError exception.
- The program will cause a ValueError exception.
Explanation: The program will raise a ValueError exception, because the tuple index() method returns the index of a given element in a tuple, and the foo tuple does not have the 0 element.
Full error message: ValueError: tuple.index(x): x not in tuple.
More Questions: Python Essentials 1 (PE1) Course Final Test
Please login or Register to submit your answer