Create a tuple and find an element from the tuple by its index number

In this python tuple program, we will create a tuple and find an element from the tuple by its index number.

Steps to solve the program
  1. Create a tuple.
  2. Find the element from the tuple having index number 2 using tuple_name[index number].
  3. Print the output.
				
					tup = (4,8,9,1)
print("Number in the tuple with index 2: ",tup[2])
				
			

Output :

				
					Number in the tuple with index 2:  9
				
			

create a tuple with different datatypes.

assign values of tuples to several variables and print them.

1 thought on “Create a tuple and find an element from the tuple by its index number”

Leave a Comment