What you aim to do is called normalization: you calculate the sum
and divide all elements by that sum:
total_inv = 1.0/sum(a.values())
for key,val in a.items():
a[key] = val*total_inv
Or even shorter (like @Jean-FrançoisFabre says) use dict comprehension:
total_inv = 1.0/sum(a.values())
a = {k:v*total_inv for k,v in a.items()}
but this will construct a new dictionary, so references to the old dictionary are not updated.
In the code we calculate 1.0/sum(..)
because a division usually is more expensive than a multiplication and thus can gain some efficiency with that.