Halloween Sale: Flat 70% + Addl. 25% Off + 30 Days Extra Lab on all Courses | Use Coupon HS25 in Checkout | Offer Expires In

  Enroll Now

Python Project - Churn Emails - Find Average Spam Confidence

In the previous exercise, we saw a couple of examples of startswith. Let's do one more hands-on with startswith

INSTRUCTIONS
  • Define a function average_spam_confidence which calculates the average spam confidence and returns it
  • Open the file mbox-short.txt which is located at /cxldata/datasets/project/mbox-short.txt
  • Loop through the file handle
  • Select only those lines starts with X-DSPAM-Confidence:
  • Split the lines at : and take the float value which is spam confidence
  • Find the average of this spam confidence in the entire file and return it.

PS - If your logic is correct then the correct spam confidence score should be 0.7507185185185187. You can use "Hint" and "See Answer" if you are stuck.


No hints are availble for this assesment

Answer is not availble for this assesment


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...