thanks for help.
1. i have input dict:
populations = {
'US-AL': 4887871,
'US-AK': 737438,
'US-AZ': 7171646}
and i have another input dict with conformity USA states and Russia subject (this conformity doesn't matter, just like instance ) here it is "another" dict:
usa_rus = {
'US-AL': 'RU-MOW',
'US-AK': 'RU-KDA',
'US-AZ': 'RU-SVE'}
2. My task is replace key in population dict. New key in population dict should be value from dict usa_rus. Another words, i want replace USA States in key to Russia subjects, value in dict population not changed.
what i want in output:
populations_new = {
'RU-MOW': 4887871,
'RU-KDA': 737438,
'RU-SVE': 7171646}
3.Unfortunately, i haven't deep knowledge in python and creating dictionary, i'm studying. I use only one solution but it is not clear:
list = []
for keys,values in populations.items():
list.append({usa_rus[keys]:values})
output:
[{'RU-MOW': 4887871}, {'RU-KRS': 737438}, {'RU-SVE': 7171646}]
Please help me to make output which i want :)