In this python tuple program, we will convert a tuple into a dictionary.
Steps to solve the program
- Take tuples inside a tuple as input.
- Convert the tuple into a dictionary using dict().
- 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'}