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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started