2.In this problem and the next one, we’re going to make a very simple spam checker program by just looking
ooking at how likely a given email is to be spam based on the words it contains. In particular, in this problem we’re going to count how often words are present in spam emails within some set of training data (which here means a set of emails that have already been marked as spam or not spam manually).
We have already started to write a function spam_score(spam_file, not_file, word), which takes in two filenames, along with a target word (a lowercase string). Both filenames refer to text files which must be in the same directory as hw07.py (we’ve provided several such files in hw07files.zip). The text files contain one email per line (really just the subject line to keep things simple) - you can assume that these emails will be a series of words separated by spaces with no punctuation. The first file contains emails that have been identified as spam, the second contains emails that have been identified as not spam.
Since you haven’t learned File I/O yet, we’ve provided code that opens the two files and puts the data into two lists of strings (where each element is one line - that is, one email). You then must complete the function, so that it returns the spam score for the target word. The spam score is an integer representing the total number of times the target word occurs across all the spam emails, minus the total number of times the word occurs in not-spam emails. Convert all words to lowercase before counting, to ensure capitalization does not throw off the count.
Risk taking is an important part of investing. In order to make suitable investment decisions on behalf of their customers,
ehalf of their customers, portfolio managers give a questionnaire to new customers to measure their desire to take financial risks. The scores on the questionnaire are approximately normally distributed with a mean of 49 and a standard deviation of 14 The customers with scores in the bottom 10% are described as "risk averse." What is the questionnaire score that separates customers who are considered risk averse from those who are not? Carry your intermediate computations to at least four decimal places. Round your answer to one decimal place.
6.1) Employees in 2012 paid 4.2% of their gross wages towards social security (FICA tax), while employers paid another 6.2%.
ers paid another 6.2%. How much will someone earning $34,000 a year pay towards social security out of their gross wages?
2) The population of a town increased from 3350 in 2005 to 4800 in 2010. Find the absolute and relative (percent) increase.
3)A company's sales in Seattle were $400,000 in 2012, while their sales in Portland were $295,000 for the same year. Complete the following statements:
a. Seattle's sales were
% larger than Portland's.
b. Portland sales were
% smaller than Seattle's.
c. Portland sales were
% of Seattle's.
4) A store has clearance items that have been marked down by 55%. They are having a sale, advertising an additional 30% off clearance items. What percent of the original price do you end up paying?
5) A friend has a 83% average before the final exam for a course. That score includes everything but the final, which counts for 15% of the course grade.
What is the best course grade your friend can earn?
What is the minimum score your friend would need on the final to earn a 75% for the course?
Give answers accurate to at least one decimal place.
6) A car is driving at 50 kilometers per hour. How far, in meters, does it travel in 3 seconds?
Give your answer to the nearest meter.