Tuples and dicts.
ok I dont see my error ... beginning to hit too many roadblocks no matter how many extra practice I do. I have this working all the way through and as far as I can tell it should be doing exactly what is needed. I need my output to be this: 04 3 06 1 07 1 09 2 10 3 11 6 14 1 15 2 16 4 17 2 18 1 19 1 Except I Keep getting mine in random order despite sorting and everything else the numbers are right just wont sort. I get this. 11 6 16 4 10 3 04 3 17 2 15 2 09 2 19 1 18 1 14 1 07 1 06 1 fname = input("Enter file name: ") fh = open(fname) count = dict() for handle in fh: if not handle.startswith("From "): continue #print(handle) time = handle.split() #creating new list time2 = time[5] #print(time2) time3 = time2.split(':') #print(time3) time4 = time3[0] #print(time4) count[time4] = count.get(time4,0) + 1 #print(time4,count[time4]) timelst = list() for timekey,valuekey in list(count.items()): timelst.append((valuekey,timekey)) timelst.sort(reverse=True) for valuekey,timekey in timelst: print(timekey,valuekey)