xxxxxxxxxx
fruits = ("Apple", "Banana", "Grapes", "Papaya", "Litchi")
for i in range(2, 5):
print(fruits[i])
xxxxxxxxxx
try:
my_tuple = (1, 2, 3)
index = 5 # Trying to access index 5 that is out of range
value = my_tuple[index]
print(value) # This will not be executed due to the error
except IndexError:
print("Tuple index is out of range. Please check your index value.")