How can I report an error if the existing dictionary sees another item in python with the same key but different value
===

Firstly, Suppose I have a dictionary like given below:
temp = {'A': 3, 'S': 1}
Now if I encounter an item like 'A': 4
will it be added to the dictionary something like:
temp = {'A': 4, 'S': 1} leaving behind the previously value of key 'A' which was 3

Secondly, if my dictionary is {'A': 3, 'S': 1} 
How can I report an error if the dictionary sees another item like 'A': 4 or 'S': 5