def count_message_from_domain():
msgdict={}
file=open(’/cxldata/datasets/project/mbox-short.txt’)
for line in file:
line=line.strip()
if line.startswith(‘From:’):
line=line.split("@")
domain=line[1]
if domain not in msgdict:
msgdict[domain]=1
else:
msgdict[domain]+=1
return(msgdict)
this is the output:
{'uct.ac.za': 6,
'media.berkeley.edu': 4,
'umich.edu': 7,
'iupui.edu': 8,
'caret.cam.ac.uk': 1,
'gmail.com': 1}
But the expected output in the question is :
{'uct.ac.za': 12,
'media.berkeley.edu': 8,
'umich.edu': 14,
'iupui.edu': 16,
'caret.cam.ac.uk': 2,
'gmail.com': 2}
please tell me how it is possible because my logic is correct but the output is different?
please solve this problem..