NP31 首都
思路:
注意如何取k和v;
代码如下:
cities_dict = {'Beijing': {'Capital': 'China'},'Moscow': {'Capital': 'Russia'},'Paris': {'Capital': 'France'}}
for k in sorted(cities_dict.keys()):
print('{} is the capital of {}!'.format(k,cities_dict[k]['Capital']))