A text file contains some text (nothing unusual) but we need to know how often (or...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
A text file contains some text (nothing unusual) but we need to know how often (or how rare) each letter appears in the text. Such an analysis may be useful in cryptography, so we want to be able to do that in reference to the Latin alphabet. Your task is to write a program which: asks the user for the input file's name; reads the file (if possible) and counts all the Latin letters (lower- and upper-case letters are treated as equal) prints a simple histogram in alphabetical order (only non-zero counts should be presented) Create a test file for the code, and check if your histogram contains valid results. Assuming that the test file contains just one line filled with: aBc Scenario Prof. Jekyll conducts classes with students and regularly makes notes in a text file. Each line of the file contains 3 elements: the student's first name, the student's last name, and the number of point the student received during certain classes. The elements are separated with white spaces. Each student may appear more than once Inside Prof. Jekyll's file. The file may look as follows: John S Anna Smith Boleyn 4.5 Smith John 2 Anna Boleyn 11 COK 1.5 Andrew Your task is to write a program which: asks the user for Prof. Jekyll's file name; reads the file contents and counts the sum of the received points for each student; prints a simple (but sorted) report, just like this one: cla cla cla A text file contains some text (nothing unusual) but we need to know how often (or how rare) each letter appears in the text. Such an analysis may be useful in cryptography, so we want to be able to do that in reference to the Latin alphabet. Your task is to write a program which: asks the user for the input file's name; reads the file (if possible) and counts all the Latin letters (lower- and upper-case letters are treated as equal) prints a simple histogram in alphabetical order (only non-zero counts should be presented) Create a test file for the code, and check if your histogram contains valid results. Assuming that the test file contains just one line filled with: aBc Scenario Prof. Jekyll conducts classes with students and regularly makes notes in a text file. Each line of the file contains 3 elements: the student's first name, the student's last name, and the number of point the student received during certain classes. The elements are separated with white spaces. Each student may appear more than once Inside Prof. Jekyll's file. The file may look as follows: John S Anna Smith Boleyn 4.5 Smith John 2 Anna Boleyn 11 COK 1.5 Andrew Your task is to write a program which: asks the user for Prof. Jekyll's file name; reads the file contents and counts the sum of the received points for each student; prints a simple (but sorted) report, just like this one: cla cla cla
Expert Answer:
Answer rating: 100% (QA)
Answer Function to count Latin letters in a text def countlatinletterstext lette... View the full answer
Related Book For
Management Accounting Information for Decision-Making and Strategy Execution
ISBN: 978-0137024971
6th Edition
Authors: Anthony A. Atkinson, Robert S. Kaplan, Ella Mae Matsumura, S. Mark Young
Posted Date:
Students also viewed these programming questions
-
Explore the Profit maximization relationship and explain how the marginal change rules and assist in a firm's decision-making.
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
List three specific parts of the Case Guide, Objectives and Strategy Section (See below) that you had the most difficulty understanding. Describe your current understanding of these parts. Provide...
-
What did Frederick Taylor, the proponent of scientific management, advocate for to achieve efficiency in manufacturing?
-
Why is it difficult to implement mutual exclusion and condition variables in an environment? Where like CPUs do not share any memory? What approach and mechanism could be used to make such features...
-
DeMagistris Fashion Company, based in New York City, imports leather coats from Acua Leather Goods, a reliable and longtime supplier, based in Buenos Aires, Argentina. Payment is in Argentine pesos....
-
An air standard diesel cycle has a compression ratio of 16. The pressure at the beginning of compression stroke is 1 bar and the temperature is 20C. The maximum temperature is \(1430 C\). Determine...
-
Review the opening feature of this chapter dealing with ash&dans and the entrepreneurial owners, Ashley Cook and Danielle Dankner. Required 1. Assume that ash&dans sells a $300 gift certificate to a...
-
A heat pump maintains a dwelling at 68F. When operating steadily, the power input to the heat pump is 10 HP, and the heat pump receives energy by heat transfer from 55F well water at a rate of 500...
-
The beginning inventory at Midnight Supplies and data on purchases and sales for a three month period ending March 31 are as follows: Date Transaction Number of Units Per Unit Total Jan. 1 Inventory...
-
Teds Ltd is a private limited company that manufactures cuddly teddy bears. The company was established in 1985 and was until recently owned and managed by the Rufus family. In 2016 the Rufus family...
-
Da Feng is looking to refinance his home because rates have gone down since he purchased the house 5 years ago. He started with a 30-year fixed-rate mortgage of $222,000 at an annual rate of 7.10%....
-
Using the information, answer the following questions: One year spot rate Two year spot rate Three year spot rate 1.25% p.a. 1.30% p.a. 1.50% p.a. What is the market consensus expectation of one year...
-
return is 17% ,beta is 1.7 risk free is 3% what is market risk premium. 2. dividend of 7.98 rate of return is 21% what is current stock price. 3. coupon rate is 10% maturity of 8 yrs current market...
-
The balance sheet for McCormick Co. is as follows: Assets Liabilities and Equity Net Fixed Assets = $400,000 Long-term Liabilities = $150,000 Current Assets = $250,000 Current Liabilities = $100,000...
-
Let f(x)=1 |x - 1| be a function defined on (0, 2). (a) Find the even and odd periodic extensions of f, and sketch their graphs with at least three periods. (b) Find the Fourier series for both the...
-
10. Problem 3.4.32. (a) Find a basis for the subspace S in R spanned by all solutions of 1+2+3 - 24 = 0.
-
(a) What is the focal length of a magnifying glass that gives an angular magnification of 8.0 when the image is at infinity? (b) How far must the object be from the lens?
-
Suppose you are the manager of a fitness center that is one of many in a chain. Give one example of a cost that you control and one example of a cost you do not control. Why is it important in this...
-
What type of organization is best suited to incentive compensation? Why?
-
Provide an example of a fixed cost that would be relevant to a make-or-buy decision, and an example of a fixed cost that would not be relevant to such a decision.
-
Make an energy diagram for gas B in Figure 20.4. Figure 20.4 When gases of different temperatures are placed in thermal contact, energy is transferred thermally from the hotter to the cooler gas...
-
Suppose you were to play the two film clips shown in Figure 20.7 backward. Would the resulting processes be possible? Figure 20.7 Quasistatic versus non-quasistatic expansion of a cylin- der...
-
(a) What are the SI units of \(Q\) ? (b) For the process depicted in Figure 20.2a, make an energy diagram for each of these systems: (i) water, pot, and flame; (ii) pot and flame; (iii) pot. Figure...
Study smarter with the SolutionInn App