Skip to content

Commit f90386b

Browse files
committed
assignment 9.4 done
1 parent 6cad4d2 commit f90386b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Assignment_9.4_.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name = input("Enter file:")
2+
if len(name) < 1 : name = "mbox-short.txt"
3+
text = open(name)
4+
5+
maxauthor = dict()
6+
7+
for line in text:
8+
line.rstrip()
9+
if not line.startswith("From "): continue
10+
words = line.split()
11+
maxauthor[words[1]] = maxauthor.get(words[1],0)+1
12+
13+
largest = None
14+
largest_author = None
15+
16+
for key in maxauthor:
17+
if largest is None: largest = maxauthor[key]
18+
19+
if largest < maxauthor[key]:
20+
largest = maxauthor[key]
21+
largest_author = key
22+
23+
print(largest_author, largest)

0 commit comments

Comments
 (0)