(g) get_total_crimes_by_type(adict, 2Dlist) takes a dictionary (crime_dict) and a 2D-list (database), and returns another dictionary whose keys are the crime types (i.e., values of crime_dict), and values are the total number of crimes of those types reported in the database. See the sample output for examples. total_crime = get_total_crimes_by_type(crime_dict, database) display_dict(total_crime) Arson - 10 Break and Enter - 621 Fraud - 849 Mischief - 943 Possession / Trafficking Stolen Goods - 38 Theft $5000 and Under - 4793 Theft - Motor Vehicle - 168 Theft Over $5000 - 96

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
(g) get_total_crimes_by_type(adict, 2Dlist) takes a dictionary (crime_dict)
and a 2D-list (database), and returns another dictionary whose keys are the crime types
l a
(i.e., values of crime_dict), and values are the total number of crimes of those types
reported in the database. See the sample output for examples.
total_crime = get_total_crimes_by_type(crime_dict, database)
display_dict(total_crime)
Arson - 10
Break and Enter - 621
849
Fraud
Mischief - 943
Possession / Trafficking Stolen Goods
Theft $5000 and Under - 4793
- 38
Theft - Motor Vehicle - 168
Theft Over $5000 - 96
Page 6 of 10
Assignment # 4
Due: Nov. 27th 10:00 PM EST
(h) get_total_crimes_by_type_and_year(adict,
(crime_dict) and a 2D-list (database), and returns another dictionary like the previous
function with year-wise break down. More precisely, the keys of this resulting dictionary
are the crime types, and the values are some 2D-lists containing elements like this - [a
unique Year, the total number of crimes of this type (the key) those are reported in this
Year]. See the sample output for an example.
2Dlist) takes a dictionary
total_crime = get_total_crimes_by_type_and_year(crime_dict, database)
display_dict(total_crime)
Arson - [['2016', 2], ['2015', 1], ['2018', 3], ['2017', 2], ['2014',
2]]
Break and Enter
[['2016', 181], ['2015', 67], ['2018', 165], ['2017',
75], ['2014', 133]]
Fraud
['2014', 140]]
Mischief - [['2016', 257], ['2015', 163], ['2018', 194], ['2017', 85],
['2014', 244]]
Possession / Trafficking Stolen Goods
['2018', 3], ['2017', 5], ['2014', 8]]
Theft $5000 and Under - [['2016', 1254], ['2015', 626], ['2018', 1268],
['2017', 716], ['2014', 929]]
Theft - Motor Vehicle - [['2016', 60], [' 2015', 18], ['2018', 53],
['2017', 16], ['2014', 21]]
Theft Over $5000 - [['2016', 21], ['2015', 11], ['2018', 35], ['2017',
11], ['2014', 18]]
[['2016', 239], ['2015', 97], ['2018', 221], ['2017', 152],
[['2016', 13], ['2015', 9],
Transcribed Image Text:(g) get_total_crimes_by_type(adict, 2Dlist) takes a dictionary (crime_dict) and a 2D-list (database), and returns another dictionary whose keys are the crime types l a (i.e., values of crime_dict), and values are the total number of crimes of those types reported in the database. See the sample output for examples. total_crime = get_total_crimes_by_type(crime_dict, database) display_dict(total_crime) Arson - 10 Break and Enter - 621 849 Fraud Mischief - 943 Possession / Trafficking Stolen Goods Theft $5000 and Under - 4793 - 38 Theft - Motor Vehicle - 168 Theft Over $5000 - 96 Page 6 of 10 Assignment # 4 Due: Nov. 27th 10:00 PM EST (h) get_total_crimes_by_type_and_year(adict, (crime_dict) and a 2D-list (database), and returns another dictionary like the previous function with year-wise break down. More precisely, the keys of this resulting dictionary are the crime types, and the values are some 2D-lists containing elements like this - [a unique Year, the total number of crimes of this type (the key) those are reported in this Year]. See the sample output for an example. 2Dlist) takes a dictionary total_crime = get_total_crimes_by_type_and_year(crime_dict, database) display_dict(total_crime) Arson - [['2016', 2], ['2015', 1], ['2018', 3], ['2017', 2], ['2014', 2]] Break and Enter [['2016', 181], ['2015', 67], ['2018', 165], ['2017', 75], ['2014', 133]] Fraud ['2014', 140]] Mischief - [['2016', 257], ['2015', 163], ['2018', 194], ['2017', 85], ['2014', 244]] Possession / Trafficking Stolen Goods ['2018', 3], ['2017', 5], ['2014', 8]] Theft $5000 and Under - [['2016', 1254], ['2015', 626], ['2018', 1268], ['2017', 716], ['2014', 929]] Theft - Motor Vehicle - [['2016', 60], [' 2015', 18], ['2018', 53], ['2017', 16], ['2014', 21]] Theft Over $5000 - [['2016', 21], ['2015', 11], ['2018', 35], ['2017', 11], ['2014', 18]] [['2016', 239], ['2015', 97], ['2018', 221], ['2017', 152], [['2016', 13], ['2015', 9],
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Hash Table
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education