When it is required to create a dictionary where keys have multiple inputs, an empty dictionary can be created, and the value for a specific key can be specified.
Below is the demonstration of the same −
Example
my_dict = {}
a, b, c = 15, 26, 38
my_dict[a, b, c] = a + b - c
a, b, c = 5, 4, 11
my_dict[a, b, c] = a + b - c
print("The dictionary is :")
print(my_dict)Output
The dictionary is :
{(15, 26, 38): 3, (5, 4, 11): -2}Explanation
The required packages are imported.
An empty dictionary is defined.
The values for a specific key are specified.
The output is displayed on the console.