Lecture Notes on 21 Nov 2014 # verify Benford's law using census data def main(): # create an empty dictionary pop_freq = {} # initialize the dictionary pop_freq['1'] = 0 pop_freq['9'] = 0 # open the file for reading in_file = open ("./Census_2009.txt", "r") # read the header header = in_file.readline() # read subsequent lines for line in in_file: line = line.strip() pop_data = line.split() print (pop_data[-1]) # process the data # close in_file.close() # write out the result main()