Why isnt the Index Error handled the first time the list is populated? The program crashes.....Code:import time from sys import exit readable_data = [] data_for_computations = [] def GetCount(): print "What is the current count?" count = raw_input(">") readable_data.append(time.ctime()) readable_data.append(count) data_for_computations.append(time.time()) data_for_computations.append(count) print readable_data print data_for_computations while 1 == 1: GetCount() try: print "The number of seconds elapsed since the last count is ", int(time.time()) - int(data_for_computations[-4]) except IndexError: continue finally: pass
Bookmarks