Answered step by step
Verified Expert Solution
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()
Modify the program in the following ways:
- 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.
- 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.
- Change your program so that if the user just hits return for a prompt, the program includes all the data for that field.
- Change the open statement in the program to use the full data set, health-no-head.csv.
- Write down the answers to the following queries:
- How many cases of Hepatitis A were reported in Utah in 2001?
- How many cases of polio have been reported in California?
- How many cases of all diseases were reported in 1956?
- 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.
- Comment your code. Be sure to add a header comment to your program and any functions, and appropriate comments before other blocks of code.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started