Question: Write a script that performs the tasks below and put it into a function p3_dictionary_manipulations(d,params) that takes the dictionary d shown, and a list of

Write a script that performs the tasks below and put it into a function p3_dictionary_manipulations(d,params) that takes the dictionary d shown, and a list of parameters, params = [Canada, France,sw,se]. The dictionary maps country names to Internet top-level domains (TLDs). The list of parameters is used to perform tasks a., b., d., and e.. d = {'Canada': 'ca', 'United States': 'us', 'Mexico': 'mx'} The function should perform the tasks shown: a. Check whether the dictionary contains the key 'Canada'. b. Check whether the dictionary contains the key 'France'. c. Iterate through the keyvalue pairs and display them in two-column format. d. Add the keyvalue pair 'Sweden' and 'sw' (which is incorrect). e. Update the value for the key 'Sweden' to 'se'. f. Use a dictionary comprehension to reverse the keys and values. g. With the result of part (f), use a dictionary comprehension to convert the country names to all uppercase letters

The program has to be written in python

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 Databases Questions!