Python: coursera assignments - Dictionary chapter
<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>

<p>Check line 3726 and 3763. There is a colon after <strong>From</strong>. I think you are missing that while searching manually.</p>

<blockquote>
  <p>Line 3726 From cwen@iupui.edu Thu Jan  3 16:23:48 2008 </p>
  
  <p>Line 3763 From: cwen@iupui.edu</p>
</blockquote>

<p>Otherwise the code is correct. It is showing correct output.</p>

python dictionary