Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Homework #2: Opioid Crisis Problem HOMEWORK INSTRUCTIONS Homework #2 Opioid Crisis Problem Introduction to Python Programming West Virginia University Page 1 of 4 Version 2.2 Modified 10/25/2019...

1 answer below »

Homework #2: Opioid Crisis Problem

HOMEWORK INSTRUCTIONS
Homework #2
Opioid Crisis Problem
Introduction to Python Programming
West Virginia University
Page 1 of 4 Version 2.2
Modified 10/25/2019
Background Information
The rapid increase in the unauthorized use of prescription and
non-prescription opioids has been a major public health threat in
the United States in recent years. These drugs are a class of
strong painkillers or analgesic drugs such morphine, heroin, and
Oxycontin.
The effects of the opioid crisis have been felt particularly hard in
West Virginia, which has the nation’s highest overdose death rate [1]. The state’s
southern coalfields (McDowell, Mercer, and Raleigh counties) has suffered some of
the most significant impacts.
Problem Statement
In this assignment, students will investigate the impact of the drug crisis on
selected West Virginia counties.
Instructions
IMPORTANT: Complete the steps below in the order they are given. Completing the
steps out of order may complicate the assignment or result in an inco
ect result.
1. Create a new Python script named lastname_firstname_hw2_ocp.py.
2. At the beginning of your script, insert a comment block containing the following
information:
# Firstname Lastname
# Date
# Computer Science 293B Section YY
# Homework #2: Opioid Crisis Problem
3. We need to store the number of drug overdose deaths per 100,000 residents
from the table below [2]:
County XXXXXXXXXX XXXXXXXXXX 2016
Wood XXXXXXXXXX XXXXXXXXXX 53.7
McDowell XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX
Mercer XXXXXXXXXX XXXXXXXXXX 74.4
Raleigh XXXXXXXXXX XXXXXXXXXX58.7
a. Create appropriate variables to store the data in the table shown above.
HOMEWORK INSTRUCTIONS
Homework #2
Opioid Crisis Problem
Introduction to Python Programming
West Virginia University
Page 2 of 4 Version 2.2
Modified 10/25/2019
4. We wish to calculate the average number of deaths for a county.
a. Create a function named get_average(). It should take the following
parameter:
Parameter Name Type Description
data List or
Dictionary
(your choice)
Data to average.
. In the body of the get_average() function, perform the following tasks:
i. Return the average of the values in the data list.
5. We need to calculate Z-scores, statistical measures of deviation from the
mean, for drug overdose rates for each year.
a. Create a function named calculate_z_scores(). It should take the
following parameter:
Parameter Name Type Description
data List or
Dictionary
(your choice)
Data to average.
. In the body of the calculate_z_scores() function, perform the following
tasks:
i. Create the following variable:
Variable Name Type Initial Value(s)
z_scores List or
Dictionary
(your choice)
[] (empty list) or {} (empty dictionary)
as appropriate
ii. Use a loop to iterate through the data list or dictionary. Each loop
iteration must do the following:
(1) Calculate the Z-score for the cu
ent value using the following
formula:
cu
ent value − average of ????
standard deviation of ???_????

(2) Append the calculated Z-score to the z_scores list or
dictionary.
iii. Return the z_scores list or dictionary.
HOMEWORK INSTRUCTIONS
Homework #2
Opioid Crisis Problem
Introduction to Python Programming
West Virginia University
Page 3 of 4 Version 2.2
Modified 10/25/2019
6. We also wish to print the statistics calculated in the previously defined
functions.
a. Create a function named print_stats(). It should take the following
parameters:
Parameter Name Type Description
deaths_data List or
Dictionary
(your choice)
Drug overdose statistics.
county String Name of the county to retrieve.
. In the body of the print_stats() function, perform the following tasks:
i. Call get_average() and print a statement listing the name of the
county and the result.
ii. Call calculate_z_scores()and store the result in a variable named
z_scores.
iii. Use a loop to iterate through each year from 2008 to 2016,
inclusive. Each loop iteration must do the following:
(1) Print a statement listing the year and the county’s Z-score for
that year.
7. We also wish to create a main function.
a. Create a function named main(). It should take no parameters.
. In the body of the main() function, perform the following tasks:
i. Call print_stats() to print the results showing data for Wood,
McDowell, Mercer, and Raleigh counties.
8. Call the main() function from the body of your program.
9. At the end of your script, add a comment block to store analysis question
esponses. Answer two of the three analysis questions below. Be sure to
indicate the question being answered with each response.
a. Based on the data provided in this project, do you believe the opioid
epidemic is getting better, getting worse, or staying the same. Explain
your rationale.
. The drug overdose rates are much higher in certain parts of the state, like
McDowell and Mercer counties, than in others, like Wood County. What is
a possible reason for this disparity?
c. What would you propose to help limit the opioids crisis?
HOMEWORK INSTRUCTIONS
Homework #2
Opioid Crisis Problem
Introduction to Python Programming
West Virginia University
Page 4 of 4 Version 2.2
Modified 10/25/2019
Grading Ru
ic
This assignment is worth 60 points. It will be graded by your instructor using this
u
ic, with partial credit awarded as appropriate:
Step 3 56points Steps 7a-b 6 points total
Steps 4a-b 12 points total Step 8 6 points
Steps 5a-b 12 points total Step 9a-c (pick 2 of 3) 3 points each
Steps 6a-b 12 points total
The analysis questions in Steps 9a-c will be evaluated using this ru
ic:
Standard
Meets Requirements
(2.5 points)
Does Not Meet
Requirements (0 points)
Answer is reasonable. Answer addresses the
question prompt and is
factually co
ect or a
easonable interpretation of
available data.
Answer does not address
the question prompt, is
factually inco
ect, or is an
unreasonable interpretation
of available data.
Answer is supported. Logical rationale is provided
to support the given
answer.
Logical rationale is not
provided to support the
given answer.
Answered Same Day Nov 04, 2021

Solution

Yogesh answered on Nov 05 2021
137 Votes
# Firstname Lastname
# Date
# Computer Science 293B Section YY
# Homework #2: Opioid Crisis Problem
yearslist = [2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016] # Column index change
countylist = ["Wood", "McDowell", "Mercer", "Raleigh"] # Row index change
datalist = [[1960000, 1040000, 1050000, 1380000, 2310000, 1960000, 2670000, 2780000, 5370000],
[10220000, 10330000, 10850000, 11970000, 7030000, 10540000, 10760000, 14120000, 7310000],
[4690000, 2250000, 5460000, 8160000, 5920000, 4030000, 7610000, 6210000, 7440000],
[2420000, 1520000, 5710000, 7580000, 7340000, 4690000, 4980000, 8000000, 5870000]]
# For 1st country i=0,
# For 2nd country i=1, ..... and so on.
# Similarly for years,
# For 1st year in the yearslist i.e. 2008, j=0
# For 2nd year i.e. 2009, j=1, ..... and so on.
def get_average(data):
global value
value = 0
for j in range(0, len(data)):
value = value + data[j]
ave_value = value / len(data)
return ave_value
def calculate_z_scores(data):
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here