Python tuple program to slice a tuple

In this python tuple program, we will slice a tuple.

Steps to solve the program
  1. Create a tuple.
  2. Slice the given tuple using tuple_name[start_index:end_index].
  3. Print the output.
				
					tup = (5,7,3,4,9,0,2)
print("Original tuple: ",tup)
print(tup[:3])
print(tup[2:5])
				
			

Output :

				
					Original tuple:  (5, 7, 3, 4, 9, 0, 2)
(5, 7, 3)
(3, 4, 9)
				
			

remove an item from a tuple.

find an index of an element in a tuple.

1 thought on “Python tuple program to slice a tuple”

Leave a Comment