26 lines
781 B
Python
26 lines
781 B
Python
# Exercise 6-11 Cities
|
|
# Learning Objective: Nest dictionaries within dictionaries.
|
|
|
|
cities = {
|
|
'amsterdam': {
|
|
'country': 'netherlands',
|
|
'population': '920,000',
|
|
'fact': 'Capital city, known for 420 jokes the world over.',
|
|
},
|
|
'dubai': {
|
|
'country': 'united arab emirates',
|
|
'population': '3.64 million',
|
|
'fact': 'Dubai has the worlds tallest skyscraper.',
|
|
},
|
|
'new york': {
|
|
'country': 'united states',
|
|
'population': '8.26 million',
|
|
'fact': 'best pizza',
|
|
},
|
|
}
|
|
|
|
for city, stats in cities.items():
|
|
print(f"\nFacts about {city}:")
|
|
print(f"\tCountry: {stats['country'].title()}")
|
|
print(f"\tPopulation: {stats['population']}")
|
|
print(f"\tFun Fact: {stats['fact'].title()}") |