We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fbb8d4d commit 3d84633Copy full SHA for 3d84633
Python_Data_Structures_assignments/Assignment_9.4.py
@@ -0,0 +1,20 @@
1
+#program to read through the mbox-short.txt and figure out who has
2
+#sent the greatest number of mail messages.
3
+senders=dict()
4
+#file_name = input("Enter file name:")
5
+file_name="mbox-short.txt"
6
+handle = open(file_name)
7
+for lines in handle:
8
+ phrase_list=lines.split()
9
+ if 'From' in phrase_list:
10
+ key=phrase_list[1]
11
+ senders[key]=senders.get(key,0)+1
12
+v_max=0
13
+email_of_max=''
14
+for k,v in senders.items():
15
+ #print(k,v)#debug line
16
+ if v>=v_max:
17
+ v_max=v
18
+ email_of_max=k
19
+
20
+print(email_of_max,v_max)
0 commit comments