From 5e71b77914b6ae2e395a5ec92328f7ceb906bb8a Mon Sep 17 00:00:00 2001 From: Ravitejavelamuri <39962669+Ravitejavelamuri@users.noreply.github.com> Date: Thu, 1 Oct 2020 00:20:01 +0530 Subject: [PATCH] Update Assignment 7.2.py~ --- week7/Assignment 7.2.py~ | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/week7/Assignment 7.2.py~ b/week7/Assignment 7.2.py~ index d43d306..70c7514 100644 --- a/week7/Assignment 7.2.py~ +++ b/week7/Assignment 7.2.py~ @@ -12,16 +12,16 @@ You can download the sample data at http://www.pythonlearn.com/code/mbox-short.t #Average spam confidence: 0.750718518519 # Use the file name mbox-short.txt as the file name -fname = raw_input("Enter file name: ") +fname = input("Enter file name: ") fh = open(fname) l = [] -for line in fh: - if not line.startswith("X-DSPAM-Confidence:") : continue - ll = line.split() +for x in fh: + if not x.startswith("X-DSPAM-Confidence:") : continue + ll = x.split() for i in ll: try: u = float(i) l.append(u) except: pass -print "Average spam confidence:",sum(l)/len(l) +print("Average spam confidence:",sum(l)/len(l))