Compute and print out how many total words it contains

Assignment Help Computer Engineering
Reference no: EM132212214

Question :

You have to write a Python program (3.5) which take two text files and compare them. you should revise the code to write some sensibly-designed reusable functions instead of simply duplicating each chunk of code and changing variable names.

Revise and enhance the program so that the program ALSO does these things:

1. Ask the user for a second text file to compare with the first one. I'll refer to the files "A" and "B" below.

2. Calculate the word frequency for text "B" in the same way it does for "A".

3. For both files, compute and print out how many total words it contains and how many distinct words they contain.

4. For both files, print out the n most frequent individual words (sorted like the provided example already does), but also showing the percentage of the total words each represents in its file. This is simple to calculate, as: frequency_of_word / total_words * 100. Round that to 2 decimal places.

5. Last, as a simple comparison of the texts, your program should print all the words that occured more than once in text "A" but not at all in "B" and vice-versa.

Reference no: EM132212214

Questions Cloud

Conducted in organizations to address problems : Explore the topic of how research is conducted in organizations to address problems or issues.
What is the running time of your pseudocode : Write the pseudocode for the Depth-First-Search algorithm DFS(G), assuming that G is represented using an adjacency-matrix representation.
Write a python function which takes two parameters : Write a python function which takes two parameters and then output the sum of these two numbers?
Outline the reasons why various elements of culture : Outline the reasons why the various elements of culture (social structures and control systems, language and aesthetics, religion and other belief systems)
Compute and print out how many total words it contains : For both files, compute and print out how many total words it contains and how many distinct words they contain.
What sort of adaptations might be beneficial : An adaptation is a characteristic of a population that develops over time that proves beneficial to that population in surviving and reproducing.
Write python code that will transfer a file reliably : Write python code that will transfer a file reliably between two hosts (a sender and a receiver).
Disclosure test before engaging in these corporate misdeeds : How do you think Kozlowski would have acted had he considered the public disclosure test before engaging in these corporate misdeeds?
Explain your choices and your reasoning : There are many factors influencing the cost of money for both individuals and corporations. Suppose you deposit money in an interest bearing account.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Calculate the mortgage payments

A program written in Java (without a graphical user interface) that will compute and display the monthly payment amount to fully amortize a $200,000.00 loan over a 30 year term at 5.75? interest.

  Show that there is a mst of g such that it contains

Let G be a connected, undirected and weighted graph. Let (a, b) be a smallest weight edge of G. Show that there is a MST of G such that it contains (a, b).

  Explain the role of us-cert in protecting the nations

write a three to four page paper in which youexplain the role of us-cert in protecting the nations industrial systems

  Search the file for every occurrence of a specified string

Write a program that asks the user for a file name and a string to search for. The program should search the file for every occurrence of a specified string.

  Given a complete binary tree t with n nodes

Given a complete binary tree T with n nodes, consider a directed graph G? having the nodes of T as its vertices.

  Is there a flaw in this scheme

Information & Network Security. Alice and Bob agree to communicate privately via email using a scheme based on RC4, but they want to avoid using a new secret key for each transmission.

  For what value of n would an i-o request of size n bytes

For what value of N would an I/O request of size N bytes, require the same amount of time to complete on each of the two systems?

  Building unix daemons - ipc using fifos

The aims of this project are as follows - To introduce you to building Unix daemons, to expose you to IPC using FIFOs and to familiarize you with the Unix dynamic loading API.

  Display the characters for the ascii values 33 through 126

Write a program that uses a "for" loop to display the characters for the ASCII values 33 through 126.

  Find the total capacitance of two capacitances

Solve the given problems. Refer to Appendix B for units of measurement and their symbols.

  Assume that you are a cto of a retail organization that has

assume that you are a cto of a retail organization that has adopted the rfid technology. discuss the advantages and

  Write a procedure called delete-text-file that prompts

Write a procedure called Delete_Text_File that prompts the user to enter the name of an external text file and then deletes that file.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd