Question: Python Programming More details can be found here Skeleton code: https://www.cse.msu.edu/~cse231/Online/Projects/Project08/proj08.py PDF description of the assignment: https://www.cse.msu.edu/~cse231/Online/Projects/Project08/Project_08.pdf #code of function get dictionary def create_dictionary(file_obj): '''

Python Programming

More details can be found here

Skeleton code:

https://www.cse.msu.edu/~cse231/Online/Projects/Project08/proj08.py

PDF description of the assignment:

https://www.cse.msu.edu/~cse231/Online/Projects/Project08/Project_08.pdf

 Python Programming More details can be found here Skeleton code: https://www.cse.msu.edu/~cse231/Online/Projects/Project08/proj08.py

#code of function get dictionary

def create_dictionary(file_obj): ''' Place Docstring here! ''' D={} file_obj.readline() for line in file_obj: line_list = line.strip().split(',') country = line_list[1] region = line_list[2] age_group = line_list[3] gender = line_list[4] geographic_area = line_list[5] diabetes = int(float(line_list[6])*1000) population = int(float(line_list[7])*1000) tup = (gender, geographic_area, diabetes, population) if region not in D: D[region] = {} if country not in D[region]: D[region][country]= {} if age_group not in D[region][country]: D[region][country][age_group]= [tup] else: D[region][country][age_group].append(tup) return D

c) get country total(data) This function receives a dictionary from a specific region, and returns a new dictionary of tuples with the number of people with diabetes and the total population for each country-the country name is the key, the tuple has total number of people with diabetes followed by the total population for the country

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!