I was reading http://www.python-course.eu/python3_formatted_output.php where I found this python code.
capital_country = {"United States" : "Washington",
"US" : "Washington",
"Canada" : "Ottawa",
"Germany": "Berlin",
"France" : "Paris",
"England" : "London",
"UK" : "London",
"Switzerland" : "Bern",
"Austria" : "Vienna",
"Netherlands" : "Amsterdam"}
print("Countries and their capitals:")
for c in capital_country:
format_string = c + ": {" + c + "}"
print(format_string.format(**capital_country))
I know capital_country is what is called 'dictionary' in Python. But I cannot understand the last two lines. Of course I understand the for loop iterates through the dictionary elements. Could somebody explain it to me?