each row in the spreadsheet has data for one census tract state sheet['bstr(row)value county sheet['cstr(row)value pop sheet['dstr(row)value make sure the key for this state exists countydata setdefault(state{}make sure the key for this county in this state exists countydata[statesetdefault(county{'tracts' 'pop' }each row represents one census tractso increment by one countydata[state][county]['tracts'+ increase the county pop by the pop in this census tract countydata[state][county]['pop'+int(poptodoopen new text file and write the contents of countydata to it the last two lines of code perform the actual calculation workincrementing the value for tracts and increasing the value for pop for the current county on each iteration of the for loop the other code is there because you cannot add county dictionary as the value for state abbreviation key until the key itself exists in countydata (that iscountydata['ak']['anchorage']['tracts'+ will cause an error if the 'akkey doesn' exist yet to make sure the state abbreviation key exists in your data structureyou need to call the setdefault(method to set value if one does not already exist for state just as the countydata dictionary needs dictionary as the value for each state abbreviation keyeach of those dictionaries will need its own dictionary as the value for each county key and each of those dictionaries in turn will need keys 'tractsand 'popthat start with the integer value (if you ever lose track of the dictionary structurelook back at the example dictionary at the start of this section since setdefault(will do nothing if the key already existsyou can call it on every iteration of the for loop without problem step write the results to file after the for loop has finishedthe countydata dictionary will contain all of the population and tract information keyed by county and state at this pointyou could program more code to write this to text file or another excel spreadsheet for nowlet' just use the pprint pformat(function to write the countydata dictionary value as massive string to file named census py add the following code to the bottom of your program (making sure to keep it unindented so that it stays outside the for loop)#python readcensusexcel py tabulates population and number of census tracts for each county working with excel spreadsheets