Question: Using Python 3, please write the following code involving dictionaries. The first three screenshots are of the assignment. The next few screenshots I've attached are
Using Python 3, please write the following code involving dictionaries. The first three screenshots are of the assignment. The next few screenshots I've attached are from the air_quality.tsv file. The file was extremely large, so I've only attached the first few pages, and that should give you sufficient info to write the code. The next few screenshots are from the cia_population.tsv file. Finally I've attached the skeleton code needed for this assignment. Thank you for your help! 













#
# function that reads in air quality data
# and returns a dictionary of average air quality
#
def make_avg_pm2_dictionary():
#
# your code goes here
#
return {}
#
# function that takes a dictionary of air quality for each country (aqd)
# and returns a dictionary with the population and air quality for each
country
# if that country has air quality data
#
def add_cia_population_data(aqd):
#
# your code goes here, clean up the data with strip
#
return {}
#
# print out country name, population, and pm2 values
# that exceed the WHO's threshold (in ug/m3) for 1 year pm2 levels
# that increase long-term mortality risk by 15% from figure 1
# Print the data sorted by the last name of the country
#
def print_exceed_threshold(data,threshold):
#
# your code goes here
#
print()
#
# call all the functions
#
def main():
# Build dictionary from air quality file
avg_pm2 = make_avg_pm2_dictionary()
# Read in cia population and create a dictionary
# with population and average pm2 data for each country
country_data = add_cia_population_data(avg_pm2)
# print countries with air quality
# exceeding WHO's guidelines
print_exceed_threshold(country_data,35)
#
#run the analysis
#
main()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
