Completed 6-11 Cities
This commit is contained in:
parent
a3d7c8d01d
commit
fec94604d2
26
Chapter_06/6-11_cities.py
Normal file
26
Chapter_06/6-11_cities.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# 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()}")
|
||||||
Loading…
x
Reference in New Issue
Block a user