title: Write a program to read through the mbox-short.txt and figure out the distribution by hour of the day for each of the messages
body: <blockquote>
    <p>10.2 Write a program to read through the mbox-short.txt and figure out the distribution by hour of the day for each of the messages. You can pull the hour out from the 'From ' line by finding the time and then splitting the string a second time using a colon.
    From stephen.marquard@uct.ac.za Sat Jan  5 09:14:16 2008
    Once you have accumulated the counts for each hour, print out the counts, sorted by hour as shown below.</p>
  </blockquote>
  
  <p>My Code: </p>
  
  <pre><code>fname = input("Enter file:")
  fhandle = open(fname)
  dic={}
  for line in fhandle:
      if not line.startswith("From "):
          continue
      else:
          line=line.split()
          line=line[5]  # accesing the list using index and splitting it 
          line=line[0:2]
      for bline in line:
          dic[bline]=dic.get(bline,0)+1   # Using this line we created a dictionary having keys and values
  #Now it's time to access the dictionary and sort in some way.
  lst=[]
  for k1,v1 in dic.items(): # dictionary er key value pair access korar jonno items method use kora hoyechhe
      lst.append((k1,v1)) # dictionary er keys and corresponding values ke lst te append korlam
  lst.sort()   #lst take sort korlam. sorting is done through key
  #print(lst)
  for k1,v1 in lst:  # we are able to access this list using key value pair as it was basically a dictionary before, It is just appended
      print(k1,v1)
  
  #print(dic)
      #print(dic)
  </code></pre>
  
  <p><strong>Desired Output:</strong> </p>
  
  <pre><code>04 3
  06 1
  07 1
  09 2
  10 3
  11 6
  14 1
  15 2
  16 4
  17 2
  18 1
  19 1
  </code></pre>
  
  <p>My Output: </p>
  
  <p><a href="https://i.stack.imgur.com/Hk0Lq.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>I don't understand what's going wrong. </p>