Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Assignment 7.2.py~ #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Krishna-Ravi
Copy link

This is another easier way to get the required output.

# Use the file name mbox-short.txt as the file name
fname = input("Enter file name: ")
fh = open(fname)
c = 0
lst = []
total = 0.0
for line in fh:
    if not line.startswith("X-DSPAM-Confidence:") : continue
    f = (line.split())
    c+=1
    lst.append(f[1])
    
for i in lst:
    total +=float(i)

print("Average spam confidence:",total/len(lst))

This code is done by me and found this easier and thought this might help others too.
:)

This is another easier way to get the required output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant