I saw this code written in an online course, and am confused why did python exactly returned 'France' 'Spain' 'Russia', and 'Japan'. I mean the country isn't actually defined as the 'key' of the given 'key value pairs'... right? Or is that how it really is defined?
capitals = {
"France": "Paris",
"Spain": "Madrid",
"Russia": "Moscow",
"Japan": "Tokyo",
}
for country in capitals:
print(country)
Prints:
France
Spain
Russia
Japan