Question: Language: Python Program used: PyCharm Interpreter: 3.6.1 at ~/anaconda/bin/python ----- ----- Starter code: https://pastebin.com/NgrECZQ7 candidates_2016: https://www.dropbox.com/s/oc8ws0qfz01664n/sk_election_candidates_2016.csv?dl=1 votecounts_2016: https://www.dropbox.com/s/ucgaf263q2x3qrm/sk_election_votecounts_2016.csv?dl=1 ----- YOU JUST NEED QUESTION #1 FROM

Language: Python

Program used: PyCharm

Interpreter: 3.6.1 at ~/anaconda/bin/python

-----

Language: Python Program used: PyCharm Interpreter: 3.6.1 at ~/anaconda/bin/python ----- ----- Startercode: https://pastebin.com/NgrECZQ7 candidates_2016: https://www.dropbox.com/s/oc8ws0qfz01664n/sk_election_candidates_2016.csv?dl=1 votecounts_2016: https://www.dropbox.com/s/ucgaf263q2x3qrm/sk_election_votecounts_2016.csv?dl=1 ----- YOU JUST NEED QUESTION #1-----

Starter code: https://pastebin.com/NgrECZQ7

candidates_2016: https://www.dropbox.com/s/oc8ws0qfz01664n/sk_election_candidates_2016.csv?dl=1

votecounts_2016: https://www.dropbox.com/s/ucgaf263q2x3qrm/sk_election_votecounts_2016.csv?dl=1

-----

YOU JUST NEED QUESTION #1 FROM THE STARTER CODE PROVIDED ABOVE.

Question 1 (5 points): Purpose: To practice the concept of dictionary as a mapping Degree of Difficulty: Easy Task: Write a function called create_mapping that takes a list of keys and a list of values as its two argu- ments, and creates (and returns) a dictionary of key-value pairs. Details: Your function must translate the two lists into a single mapping dictionary, the first list containing an ordered list of keys and the second list containing an ordered list of corresponding values. In other words, the first item of the first list will be a key in the new dictionary and the first item of the second list will be the value stored at that key Example: Given a list of keys containing political party names (eg.SK, , ,NDP. ,LIB']) and a list of values containing vote counts (e.g. [400, 900, 1400]). your function should return a dictionary of party vote count pairs (e.g. 'SK':400, 'NDP' :900, 'LIB' 1400). Your function should work for lists of any length, provided that the lists are the same length. Note: The example is specific to the topic of our app but this function is a general tool to build dictionaries, and can be applied to any tasks where keys and values might come from different data sources. Testing: Before going on, you want to be sure that your function works properly. The starter file has the testing code, but it will be initially part of a comment. Uncomment the testing for this question while you are working on it and comment it out when you are finished

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!