switching keys and values in a dictionary in python [duplicate]

my_dict = {2:3, 5:6, 8:9}

new_dict = {}
for k, v in my_dict.items():
    new_dict[v] = k

Here is what the above code is Doing:
1. Create an empty dictionary called new_dict
2. Iterate through the key-value pairs in my_dict
3. For each key-value pair, add a new key-value pair to new_dict where the key is the value from my_dict and the value is the key from my_dict

For example, if the first key-value pair in my_dict is 2:3, then the first key-value pair in new_dict will be 3:2.