Complete the code to get the first element of the tuple.
my_tuple = (10, 20, 30) first_element = my_tuple[1]
Use square brackets with index 0 to get the first element of a tuple.
Complete the code to get the last element of the tuple using negative indexing.
my_tuple = ('a', 'b', 'c', 'd') last_element = my_tuple[1]
Negative indexing starts from the end. Index -1 gives the last element.
Fix the error in the code to slice the tuple from index 1 to 3 (excluding 3).
my_tuple = (5, 10, 15, 20, 25) slice_part = my_tuple[1]
Use square brackets with colon to slice tuples: [start:end].
Fill both blanks to get a slice of the tuple from the second element to the end.
my_tuple = ('x', 'y', 'z', 'w') slice_part = my_tuple[1][2]
To slice from index 1 to the end, use [1:] with square brackets.
Complete the code to get every second element from the tuple starting at index 0.
my_tuple = (2, 4, 6, 8, 10, 12) slice_part = my_tuple[[1]]
Use [::2] to slice every second element from the start to the end.
