Computer Science

Carefully read the given code fragments and figure out the errors that the code may produce.

t = ('a', 'b', 'c', 'd', 'e')  
print(t[5])

Python Tuples

9 Likes

Answer

Output
IndexError: tuple index out of range 
Explanation

Tuple t has 5 elements starting from index 0 to 4. t[5] will throw an error since index 5 doesn't exist.

Answered By

5 Likes


Related Questions