Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

While using python... # Open and read health data file one line at a time # Columns are # disease,increase,location,number,population,year file = open(health-no-head-sample.csv, r) #

While using python...

# Open and read health data file one line at a time # Columns are # disease,increase,location,number,population,year

file = open("health-no-head-sample.csv", "r")

# Process each line of the file for aline in file: print (aline) values = aline.split(',') print (values)

# Close file file.close()image text in transcribed

Modify the program in the following ways:

  1. Write each line as part of a table, include a header before the table, and a summary line at the end. Use a fixed width for each column.
    1. Use some if statements to add three filters to your program that let the user select exactly one state, disease and year to include in the report. Prompt the user to enter these values.
  2. Change your program so that if the user just hits return for a prompt, the program includes all the data for that field.
  3. Change the open statement in the program to use the full data set, health-no-head.csv.
  4. Write down the answers to the following queries:
    1. How many cases of Hepatitis A were reported in Utah in 2001?
    2. How many cases of polio have been reported in California?
    3. How many cases of all diseases were reported in 1956?
  5. Add another feature to your program. This could be something like printing the highest and lowest numbers for each query, or allowing the user to just type the first part of value, so that entering 20 for the year generates a table for years 2000, 2001, 2002, 2011, or entering D for a state gives information on Delaware and the District of Columbia.
  6. Comment your code. Be sure to add a header comment to your program and any functions, and appropriate comments before other blocks of code.
Q Search Sheet Insert Page Layout Formulas Data Review View Share ^ X Insert A- Merge & Center, $, 96 , .00 .00 conditional Format Cell Calibri (Body) , 1, A, Wrap Text , B 1 u,-, d , A, Paste Sort & Formatting as Table Styles A1 MEASLES 0 206.98 COLORADO 634.95 CONNECTICUT 256.02 DELAWARE 535.63 DISTRICT OF COLUMBIA 119.58 FLORIDA 099 1014000 0014 1577000 597 233000 479000 1714 1433000 1928 1928 1928 1928 1928 1928 1928 1928 1928 1928 1928 1928 1928 1928 1928 1929 1929 1929 1929 1929 1929 1929 1929 1929 1929 1929 1929 1929 1929 1929 1930 1930 1930 1930 1930 2 MEASLES 4 MEASLES S MEASLES 6 POLIO 2566 7.04 COLORADO .53 CONNECTICUT 3.44 DELAWARE 6.92 DISTRICT OF COLUMBIA 147 FLORIDA 71 72 1577000 10 POLIO 11 SMALLPOX 12 SMALLPOX 33 479000 21 1433000 340 1014000 161 1577000 33.58 COLORADO 10.19 CONNECTICUT 0.86 DELAWARE 15 SMALLPOX 16 MEASLES 17 MEASLES 2.1 DISTRICT OF COLUMBIA 10.99 FLORIDA 74.24 COLORAD0 0479000 157 1433000 748 1008000 800 1594000 614.82 CONNECTICUT 239.82 DELAWARE 19 MEASLES 20 MEASLES 21 POLIO 94.2 DISTRICT OF COLUMBIA 78.01 FLORIDA 483000 11271445000 13 COLORADO 1.32 CONNECTICUT 2.1 DELAWARE 1.26 DISTRICT OF COLUMBIA .38 FLORIDA 24 POLIO 25 POLIO 26 SMALLPOX 27 SMALLPOX 34 1445000 844 1008000 43 1594000 83.77 COLORAD0 2.69 CONNECTICUT 0.84 DELAWARE O DISTRICT OF COLUMBIA 30 SMALLPOX 31 MEASLES 32 MEASLES 2.52 FLORIDA 1132.76 COLORADO 36 1445000 117811040000 1810 1613000 112.23 CONNECTICUT 109.25 DELAWARE 34 MEASLES 35 MEASLES 182.1 DISTRICT OF COLUMBIA 356.59 FLORIDA 488000 5245 1471000 100%

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions