title: Python: coursera assignments - Dictionary chapter
body: <p>I'm trying to solve the assignments from coursera - Python.</p>
  
  <p>Write a program to read through the mbox-short.txt and figure out who has the sent the greatest number of mail messages. The program looks for 'From ' lines and takes the second word of those lines as the person who sent the mail. The program creates a Python dictionary that maps the sender's mail address to a count of the number of times they appear in the file. After the dictionary is produced, the program reads through the dictionary using a maximum loop to find the most prolific committer.</p>
  
  <pre><code>name = raw_input("Enter file:")
  if len(name) &lt; 1 : name = "mbox-short.txt"
  handle = open(name)
  
  lst = list()
  for line in handle:
      line = line.strip()
      if line.startswith("From"):
          words = line.split()
          email = words[1]
          lst.append(email)
  
  dct = dict()
  for email in lst:
      dct[email] = dct.get(email,0)+1
  
  bigcount = None
  email_address = None
  for key,value in dct.items():
      if bigcount is None or value &gt; bigcount:
          bigcount = value
          email_address = key
  
  print email_address, bigcount
  </code></pre>
  
  <p>My code runs, but the desired output should be: cwen@iupui.edu 5  , but i get somehow "doubled" output: cwen@iupui.edu 10</p>
  
  <p>Did anyone solved this problem? Could you please give me a hint what have i missed? Thank you a lot!</p>