Question
Write a python program to read the file, and produce a summary of the total reported crimes for each state. Like this... State Reported Crimes
Write a python program to read the file, and produce a summary of the total reported crimes for each state.
Like this...
State Reported Crimes Alabama 8,133,055 Alaska 1,198,047 ... Wyoming 834,588 United States 563,841,249
There are a lot of fields in the data file, but you can simplify your life by using subtotal fields, Totals.Property.All and Totals.Violent.All.
Once you have the summary, change your program so it writes the summary to a file, crime_summary.txt.
Make sure you use a dictionary for this assignment. The obvious case is to use a key of state names and the value is the accumulated count of reported crimes. There might be a place for another dictionary as well, though you only need to use one.
Be sure to add a header comment to your program and any functions, and appropriate comments before other blocks of code.
Tea 47 36 3 9 1 25 14 2 48 48 3 1 20 61 48 009 9 9 66 59 7 2 103 199 196 103 102 160 220 171 05 68 70 0 4 0.2 nd 10 .8 4343 0.5 22 3.5 2 1 1 1 4 1 6 2 22841 2.5 s 1 6 6 1 7 5 8 .2 .8 21 47 .8 .3 387 .8 3 7 7 S 2.2 4 76 .8 6332 E Fm 32 ses 160 57 68 210 100 202 009 199 201 125 38 125 14 31 and012 196 103 130 76 198 125 194 190 15 .9 126 .9 ,4 ,4 .9 .4 .5 ,4 ,4 8 5 S 9 7 2 2 7 7 2 1 .4 2 5 1 .4 .3 584526 6 .4 .8 .1 .5 123456789 10 1 2 3 4 5 6 7 8 1 2 2 2 2 2 2 2 2 28 29 30-23 Tea 47 36 3 9 1 25 14 2 48 48 3 1 20 61 48 009 9 9 66 59 7 2 103 199 196 103 102 160 220 171 05 68 70 0 4 0.2 nd 10 .8 4343 0.5 22 3.5 2 1 1 1 4 1 6 2 22841 2.5 s 1 6 6 1 7 5 8 .2 .8 21 47 .8 .3 387 .8 3 7 7 S 2.2 4 76 .8 6332 E Fm 32 ses 160 57 68 210 100 202 009 199 201 125 38 125 14 31 and012 196 103 130 76 198 125 194 190 15 .9 126 .9 ,4 ,4 .9 .4 .5 ,4 ,4 8 5 S 9 7 2 2 7 7 2 1 .4 2 5 1 .4 .3 584526 6 .4 .8 .1 .5 123456789 10 1 2 3 4 5 6 7 8 1 2 2 2 2 2 2 2 2 28 29 30-23Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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