invert(codes) that flips a dict like {'IN': 'India'} into {'India': 'IN'} with a dict comprehension. Assume values are unique — but uppercase the new values (the codes) in the same pass.invert({'in': 'India', 'us': 'USA'}){'India': 'IN', 'USA': 'US'}Keys and values swap; codes get uppercased.
Iterate .items() and swap positions.
Apply .upper() to the code as it becomes the value.