cities_dict = {'Beijing': {'Capital': 'China'},'Moscow': {'Capital': 'Russia'},'Paris': {'Capital': 'France'}} for i in sorted(cities_dict.keys()): print('%s is the capital of %s!'%(i,cities_dict[i]['Capital']))