capitals = {
'USA': 'Washington D.C.',
'France': 'Paris',
'Brazil': 'BrasÃlia',
'Peru': 'Lima'
}
swapped_dict = {}
for key, value in capitals.items():
# assign swapped key-value pair to swapped_dict
print(swapped_dict)
# expected output:
# {
# 'Washington D.C.': 'USA',
# 'Paris': 'France',
# 'BrasÃlia': 'Brazil',
# 'Lima': 'Peru'
# }
Python
Setting up Python environment...
Output