(d) create_area_dict(list2D) that takes a 2D-list containing the database as input and creates a dictionary called area_dict (you may rename it), where keys are the identity number of a CMA (ID) and values are the name of the CMA (Area). This function must return the dictionary. See sample output below. area_dict = create_area_dict(database) display_dict(area_dict) 31 - Cityview - Crestview - Meadowlands 903 - Billings Bridge - Alta Vista 908 - Byward Market 912 Carson Grove - Carson Meadows 923 - Glebe - Dows Lake 940 - Overbrook - McArthur 942 949 Portobello South Sandy Hill West Centertown 957

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter13: Structures
Section13.5: Dynamic Data Structure Allocation
Problem 3E
icon
Related questions
icon
Concept explainers
Question
(d) create_area_dict(list2D) that takes a 2D-list containing the database as input and
creates a dictionary called area_dict (you may rename it), where keys are the identity
number of a CMA (ID) and values are the name of the CMA (Area). This function must
return the dictionary. See sample output below.
area_dict = create_area_dict(database)
display_dict(area_dict)
31 - Cityview - Crestview - Meadowlands
903 - Billings Bridge - Alta Vista
908 - Byward Market
912
Carson Grove
Carson Meadows
923
Glebe - Dows Lake
940
Overbrook - McArthur
942 - Portobello South
949 - Sandy Hill
957 - West Centertown
(e) create_crime_dict(filename) that takes the filename of a csv file as input and
returns a dictionary called crime_dict (you may rename it). This function reads the
header of the csv file and stores data in crime_dict such that keys are the indices of a
crime type on the header row, and values are the corresponding crime types (names are
case sensitive). You can assume that indices start from zero (0) on the header row. The
function must return this dictionary. See sample output below.
crime_dict = create_area_dict(filename)
display_dict(crime_dict)
3 - Arson
4 - Break and Enter
5 - Fraud
6 -
Mischief
7 - Possession / Trafficking Stolen Goods
8 - Theft - Motor Vehicle
9 - Theft $5000 and Under
Theft Over $5000
10 -
Transcribed Image Text:(d) create_area_dict(list2D) that takes a 2D-list containing the database as input and creates a dictionary called area_dict (you may rename it), where keys are the identity number of a CMA (ID) and values are the name of the CMA (Area). This function must return the dictionary. See sample output below. area_dict = create_area_dict(database) display_dict(area_dict) 31 - Cityview - Crestview - Meadowlands 903 - Billings Bridge - Alta Vista 908 - Byward Market 912 Carson Grove Carson Meadows 923 Glebe - Dows Lake 940 Overbrook - McArthur 942 - Portobello South 949 - Sandy Hill 957 - West Centertown (e) create_crime_dict(filename) that takes the filename of a csv file as input and returns a dictionary called crime_dict (you may rename it). This function reads the header of the csv file and stores data in crime_dict such that keys are the indices of a crime type on the header row, and values are the corresponding crime types (names are case sensitive). You can assume that indices start from zero (0) on the header row. The function must return this dictionary. See sample output below. crime_dict = create_area_dict(filename) display_dict(crime_dict) 3 - Arson 4 - Break and Enter 5 - Fraud 6 - Mischief 7 - Possession / Trafficking Stolen Goods 8 - Theft - Motor Vehicle 9 - Theft $5000 and Under Theft Over $5000 10 -
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Types of Linked List
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr