Your keys aren't binary numbers, they're strings representing binary numbers. To reverse a string, you can use slice
notation:
s = s[::-1]
To reverse all of the (str
) keys in a dictionary:
dct = {k[::-1]: v for k, v in dct.items()}
To simultaneously calculate the numerical values using the int(s, 2)
notation:
dct = {int(k[::-1], 2): v for k, v in dct.items()}