Nov-28-2019, 10:09 PM
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 (don’t try to find the largest width like you did in the previous unit). Not every field of the original line is used in the output. You will have to do some research about the .format() function to print the number of cases with a comma. If you can’t get the comma in the number column, move on and come back to that once you have more of the program written. The key is to have all the columns line up.
2. 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.
example
Enter state: Colorado
Enter disease: smallpox
Enter year: 1928
State Disease Number Year
COLORADO SMALLPOX 340 1928
Total 340
3. Change your program so that if the user just hits return for a prompt, the program includes all the data for that field. For example:
Enter state (Empty means all): Colorado
Enter disease (Empty means all):
Enter year (Empty means all): 1928
State Disease Number Year
COLORADO MEASLES 2,099 1928
COLORADO POLIO 71 1928
COLORADO SMALLPOX 340 1928
Total 2,510
2. 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.
example
Enter state: Colorado
Enter disease: smallpox
Enter year: 1928
State Disease Number Year
COLORADO SMALLPOX 340 1928
Total 340
3. Change your program so that if the user just hits return for a prompt, the program includes all the data for that field. For example:
Enter state (Empty means all): Colorado
Enter disease (Empty means all):
Enter year (Empty means all): 1928
State Disease Number Year
COLORADO MEASLES 2,099 1928
COLORADO POLIO 71 1928
COLORADO SMALLPOX 340 1928
Total 2,510
Attached Files
health-no-head-sample.csv (Size: 1.84 KB / Downloads: 168)