Check the type of the input and return True if the type is a tuple

In this python tuple program, we will check the type of the input and return True if the type is a tuple.

Steps to solve the program
  1. Take a tuple as input.
  2. Use an if-else statement and print True if the type is a tuple and False if it is not a tuple.
  3. Print the output.
				
					tup = (7,4,9,2,0)
if type(tup) == tuple:
    print("True")
else:
    print("False")
				
			

Output :

				
					True
				
			

program to swap tuples.

find the last element of a tuple using negative indexing.

Leave a Comment