Python tuple program to convert a tuple into a dictionary

In this python tuple program, we will convert a tuple into a dictionary.

Steps to solve the program
  1. Take tuples inside a tuple as input.
  2. Convert the tuple into a dictionary using dict().
  3. Print the output.
				
					tup = ((5,'s'),(6,'l'))
print("Tuple: ",tup)
D = dict(tup)
print("Dictionary: ",D)
				
			

Output :

				
					Tuple:  ((5, 's'), (6, 'l'))
Dictionary:  {5: 's', 6: 'l'}
				
			

find the length of a tuple.

program to reverse a tuple.

Leave a Comment