using a set in a dictionary key python code example
Example 1: how to set a key of dict in python
# declaring dict
dictionary={'Hello':3,'World!':4}
# creating function
def dict_add(obj,key,value):
obj[key]=value
reutrn obj
# using the functiom
dict_add(dictionary,'Python',10)
print (dictionary) # output --> { 'Hello':3 ,'World!':4 , 'Python':10 }
Example 2: python dictionary value as set
word_dict = dict()
word_dict["foo"] = set()
word_dict["foo"].add("baz")
word_dict["foo"].add("bang")