There was an error while loading. Please reload this page.
1 parent 17cbc4b commit 74e7113Copy full SHA for 74e7113
assignment.py
@@ -0,0 +1,13 @@
1
+# Use the file name mbox-short.txt as the file name
2
+
3
+fname = input("Enter file name: ")
4
+fh = open(fname)
5
+count = 0
6
+average = 0
7
+for line in fh:
8
+ if not line.startswith("X-DSPAM-Confidence:") : continue
9
+ average += float(line[20:-1].strip())
10
+ count = count + 1
11
+ #print(line)
12
13
+print("Average spam confidence:", (average/count))
0 commit comments