Create the opposite dictionary:
PIX1 = {}
for key in PIX0.keys():
PIX1[PIX0.get(key)] = key
Then run the same code on this dictionary instead (using PIX1
instead of PIX0
).
BTW, I'm not sure about Python 3, but in Python 2 you need to use raw_input
instead of input
.