Use chained square brackets to select and print out the capital of France.Create a dictionary, named data, with the keys 'capital' and 'population'. Set them to 'rome' and 59.83, respectively.Add a new key-value pair to europe; the key is 'italy' and the value is data, the dictionary you just built.
Question
Use chained square brackets to select and print out the capital of France.Create a dictionary, named data, with the keys 'capital' and 'population'. Set them to 'rome' and 59.83, respectively.Add a new key-value pair to europe; the key is 'italy' and the value is data, the dictionary you just built.
Solution
Here is how you can do it in Python:
Step 1: Create a dictionary named 'europe' with the key 'france' and its value as another dictionary with 'capital' and 'population' as keys.
europe = {'france': {'capital':'Paris', 'population':66.9}}
Step 2: Use chained square brackets to select and print out the capital of France.
print(europe['france']['capital'])
Step 3: Create a dictionary, named data, with the keys 'capital' and 'population'. Set them to 'rome' and 59.83, respectively.
data = {'capital':'Rome', 'population':59.83}
Step 4: Add a new key-value pair to europe; the key is 'italy' and the value is data, the dictionary you just built.
europe['italy'] = data
Now, the 'europe' dictionary should look like this:
{'france': {'capital':'Paris', 'population':66.9}, 'italy': {'capital':'Rome', 'population':59.83}}
Similar Questions
Question 1: Consider the following list of countries and their capital cities:country_capitals = ["USA: Washington D.C.", "France: Paris", "India: New Delhi", "Russia: Moscow", "China: Beijing"]Create a dictionary using a dictionary comprehension where the country name is the key and the capital city is the value.
Given the CITY and COUNTRY tables, query the names of all the continents (COUNTRY.Continent) and their respective average city populations (CITY.Population) rounded down to the nearest integer.
Select all records where the City column has the value "Berlin".
Consider the following HTML code and the web page content it produces:<!DOCTYPE html><html><body><h3>Paris</h3><p>Paris is the capital city of the French Republic. It is the most populous city in France. In 2013, the population inside the city limits was just 2,229,621. However, Ile-de-France, the region which includes Paris and most of its metro area, had a population of 12,005,077 in 2014.</p></body></html> ParisParis is the capital city of the French Republic. It is the most populous city in France. In 2013, the population inside the city limits was just 2,229,621. However, Ile-de-France, the region which includes Paris and most of its metro area, had a population of 12,005,077 in 2014Which of the following blocks of HTML code will produce the same result as the code above?.Group of answer choices<!DOCTYPE html><html><body><h3> Paris </h3><p>Paris is the capital city of the French Republic. It is the most populous city in France.In 2013, the population inside the city limits was just 2,229,621. However, Ile-de-France, the region which includes Paris and most of its metro area, had a population of 12,005,077 in 2014.</p></body></html><!DOCTYPE html><html><body><h1>Paris</h1><p>Paris is the capital city of the French Republic. It is the most populous city in France. In 2013, the population inside the city limits was just 2,229,621. However, Ile-de-France, the region which includes Paris and most of its metro area, had a population of 12,005,077 in 2014.</p></body></html><!DOCTYPE html><html><body><h8>Paris</h8><p>Paris is the capital city of the French Republic. It is the most populous city in France. In 2013, the population inside the city limits was just 2,229,621. However, Ile-de-France, the region which includes Paris and most of its metro area, had a population of 12,005,077 in 2014.</p></body></html><!DOCTYPE html><html><body><h>Paris</h><p>Paris is the capital city of the French Republic. It is the most populous city in France. In 2013, the population inside the city limits was just 2,229,621. However, Ile-de-France, the region which includes Paris and most of its metro area, had a population of 12,005,077 in 2014.</p></body></html>
Query the NAME field for all American cities in the CITY table with populations larger than 120000. The CountryCode for America is USA.The CITY table is described as follows:
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.