mydict = {}
mydict[k] = value
value = mydict[k]
value = mydict.get(k)
value = mydict.get(k, “default_value”)
key
| The desired key to lookupvalue
| The value to set or returnHelpful items to remember when creating a dictionary:
hash
function to hash it; otherwise TypeError
will be thrown)