Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python .edu d-3245578-dt-content-rid-25147671/courses/UMKC-EC-ENGR216-0001-13989-SP2018/P Background The Centers for Disease Control (CDC) keeps data on what it calls Winnable Battle Risk Factors and Health Indicators. In this

Python image text in transcribed
image text in transcribed
.edu d-3245578-dt-content-rid-25147671/courses/UMKC-EC-ENGR216-0001-13989-SP2018/P Background The Centers for Disease Control (CDC) keeps data on what it calls "Winnable Battle Risk Factors and Health Indicators". In this project you will examine some CDC data to discover the states with the best and worst records in regards to five of these risk factors and health indicators. Project Specifications The file "riskfactors.csv" lists data on 20 different risk factors and health indicators for each state. The data is in "comma separated value" format (csv), which means that each entry is separated from the others by a comma. Examining the file in a text editor or a spreadsheet program or both should help you understand the format. We grabbed this file from the CDC web page and have placed a copy in the project directory for you on Blackboard. Since analyzing 20 different indicators can be a bit confusing, we will only look at five: Heart Disease Death Rate Motor Vehicle Death Rate Teen Birth Rate Adult Smoking . Adult Obesity Your program will read in the data from the csv file and find the states with the best and worst record for each of these indicators (largest and smallest values). It will produce a file called "best_and_worst.txt" which lists the states that have the highest and lowest value for each of the indicators, along with their values (see sample output below.) Requirements: 1. You must create and use at least 2 meaningful functions (your choice). (Hint: a function to read the file and return its contents as a list? A function that returns the max and min values for states?.. It's up to you) Prompt for the input file. Your program must check if the file exists. If it does not, your program should output a "file not found" message and keep asking until a correct file is entered. (You do not need to prompt for the output file name.) 1. Your program must format the file into columns (see below). You don't have to match our formatting exactly, but columns should line up and it should be readable. Use string 2. formatting G Search or type URL

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions