# Specification: What your program will need to do Input Your progr...

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

t math

def main(textfile1, arg2, normalize=False):
if arg2 == "listing":
# obtain profile of the text file
profile = get_profile(textfile1, normalize)

# print the profile to standard output
print("profile of text " + textfile1)
for parameter, value in profile.items():
print(parameter + "\t%.4f" % value)

else:
# obtain profiles of two text files
profile1 = get_profile(textfile1, normalize)
profile2 = get_profile(arg2, normalize)

# calculate the distance between two profiles and print the results out
squared_sum_of_diffs = 0.0
for parameter in profile1:
squared_sum_of_diffs += math.pow((profile1[parameter] - profile2[parameter]), 2)
print("The distance between the two texts is: %.4f" % math.sqrt(squared_sum_of_diffs))

# this function returns the "profile" of a given text file. if normalize is set to True,
# profile values are normalized by dividing them by total number of sentences
def get_profile(textfile, normalize):
file = open(textfile, "r")
total_words = 0
total_sentences = 0
total_paragraphs = 0
profile = {
"'": 0.0,
",": 0.0,
"-": 0.0,
";": 0.0,
"also": 0.0,
"although": 0.0,
"and": 0.0,
"as": 0.0,
"because": 0.0,
"before": 0.0,
"but": 0.0,
"for": 0.0,
"if": 0.0,
"nor": 0.0,
"of": 0.0,
"or": 0...

By purchasing this solution you'll be able to access the following files:
Solution.py.

\$90.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available Python Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.