Question: Write a Python program that creates and uses following dictionary, which maps country name to Internet top - level domains ( TLDs ) : tlds

Write a Python program that creates and uses following dictionary, which maps country name to Internet top-level domains (TLDs):
tlds ={Canada:ca,United States:us,Mexico:mx}
Perform the following tasks and display the results:
Check whether the dictionary contains the key Canada
Check whether the dictionary contains the key France
Iterate through the key-value pairs and display them in two-column format
Add the key-value pair Sweden and sw(which is incorrect)
Update the value for the key Sweden to se
Use a dictionary comprehension to reverse the keys and values
With the result of part F, use a dictionary comprehension to convert the country name to all uppercase letters

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!