Program to create a tuple with different datatypes

In this python tuple program, we will create a tuple with different datatypes.

Steps to solve the program
  1. You can simply create a tuple with different datatypes by adding elements with different datatypes in () to create a  tuple.
  2. Print the output.
				
					tup = (2.6,1,'Python',True,[5, 6, 7],(5, 1, 4),{'a':123,'b':456})
print("Tuple: ",tup)
				
			

Output :

				
					Tuple:  (2.6, 1, 'Python', True, [5, 6, 7], (5, 1, 4), {'a': 123, 'b': 456})
				
			

create a list of tuples from a list having a number and its square in each tuple.

create a tuple and find an element from it by its index no.

1 thought on “Program to create a tuple with different datatypes”

Leave a Comment