get_total_cases() takes the a 2D-list (similar to database) and an integer x from this set {0, 1, 2} as input parameters. Here, 0 represents Case_Reported_Date, 1 represents Age_Group and 2 represents Client_Gender (these are the fields on the header row, the integer value represents the index of each of these fields on that row). This function computes the total number of reported cases for each instance of x in the text file, and it stores this information in a dictionary in this form {an_instance_of_x : total_case}. Finally, it returns the dictionary and the total number of all reported cases saved in this dictionary.

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
100%

get_total_cases() takes the a 2D-list (similar to database) and an integer x from this
set {0, 1, 2} as input parameters. Here, 0 represents Case_Reported_Date, 1 represents
Age_Group and 2 represents Client_Gender (these are the fields on the header row, the
integer value represents the index of each of these fields on that row). This function computes
the total number of reported cases for each instance of x in the text file, and it stores this
information in a dictionary in this form {an_instance_of_x : total_case}. Finally, it returns
the dictionary and the total number of all reported cases saved in this dictionary.

This section describes the required functions that you must add to your module. You are
encouraged to create additional helper functions where necessary. You must test these functions
using different text files inside the main() function. The final version of your module must only
contain functions and a single call to the main() function (i.e., there should not be any additional
function calls or print statements outside the main() function).
(e) get_total_cases() takes the a 2D-list (similar to database) and an integer x from this
set {0, 1, 2} as input parameters. Here, 0 represents Case_Reported_Date, 1 represents
Age_Group and 2 represents Client_Gender (these are the fields on the header row, the
integer value represents the index of each of these fields on that row). This function computes
the total number of reported cases for each instance of x in the text file, and it stores this
information in a dictionary in this form {an_instance_of_x : total_case}. Finally, it returns
the dictionary and the total number of all reported cases saved in this dictionary.
(Suppose we want to know the total number of cases reported on each date, so use x = 0.)
>>> result, total_cases = get_total_cases (database, 0)
>>> display_dict(result)
2021-05-19: 8
2021-05-20: 2
2021-05-21: 1
2021-05-22: 1
>>> print(total_cases)
Transcribed Image Text:This section describes the required functions that you must add to your module. You are encouraged to create additional helper functions where necessary. You must test these functions using different text files inside the main() function. The final version of your module must only contain functions and a single call to the main() function (i.e., there should not be any additional function calls or print statements outside the main() function). (e) get_total_cases() takes the a 2D-list (similar to database) and an integer x from this set {0, 1, 2} as input parameters. Here, 0 represents Case_Reported_Date, 1 represents Age_Group and 2 represents Client_Gender (these are the fields on the header row, the integer value represents the index of each of these fields on that row). This function computes the total number of reported cases for each instance of x in the text file, and it stores this information in a dictionary in this form {an_instance_of_x : total_case}. Finally, it returns the dictionary and the total number of all reported cases saved in this dictionary. (Suppose we want to know the total number of cases reported on each date, so use x = 0.) >>> result, total_cases = get_total_cases (database, 0) >>> display_dict(result) 2021-05-19: 8 2021-05-20: 2 2021-05-21: 1 2021-05-22: 1 >>> print(total_cases)
12
The sample output for x = 1 (Age_Group)
>>> result, total_cases = get_total_cases (database, 1)
>>> display_dict(result)
20: 1
30: 1
40: 2
60: 2
70: 1
<20: 5
>>> print(total_cases)
12
The sample output for x = 2 (Client_Gender)
>>> result, total_cases =
>>> display_dict(result)
get_total_cases (database, 2)
FEMALE: 4
GENDER DIVERSE: 1
MALE: 6
UNSPECIFIED: 1
>>> print (total_cases)
12
Transcribed Image Text:12 The sample output for x = 1 (Age_Group) >>> result, total_cases = get_total_cases (database, 1) >>> display_dict(result) 20: 1 30: 1 40: 2 60: 2 70: 1 <20: 5 >>> print(total_cases) 12 The sample output for x = 2 (Client_Gender) >>> result, total_cases = >>> display_dict(result) get_total_cases (database, 2) FEMALE: 4 GENDER DIVERSE: 1 MALE: 6 UNSPECIFIED: 1 >>> print (total_cases) 12
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Binary Search Algorithm
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