Dictionary of tuples with tuples as values

Here we will pass values as tuples inside a dictionary

Syntax:

{key:(tuple),key :(tuple2).........,key:(tuple)}

Here tuple is a collection of elements that represent some value for some key.

Example: Python program to create dictionary of tuples with tuple as values

Python3




# tuple of favourite food as value
# key is name of student
data = {'Bobby': ("chapathi", "roti"), 
        'ojaswi': ("Paraota", "Idly", "Dosa")}
  
# display
data


Output:

{'Bobby': ('chapathi', 'roti'), 'ojaswi': ('Paraota', 'Idly', 'Dosa')}

Python – Create Dictionary Of Tuples

In this article, we will discuss how to create a dictionary of tuples in Python.

Similar Reads

Dictionary of tuples with tuples as keys

Here we will pass keys as tuples inside a dictionary...

Dictionary of tuples with tuples as values

...

Create a dictionary from tuples

Here we will pass values as tuples inside a dictionary...