Why is this code adding the key but not the value for a dictionary in Python?
Here is the result:
$ python hashtest.py
set(['yes:no'])
set(['hi', 'yes:no'])
And the code is as follows:
hashmap={"yes:no"}
print hashmap
var1="hi"
var2="bye"
#hashmap[var1]=var2
#print hashmap
hashmap.update({var1:var2})
print hashmap
The first method (hashmap[var1] = var2
) gave a type error (assignment).
TIA