Question: A text file contains some text (nothing unusual) but we need to know how often (or how rare) each letter appears in the text.

A text file contains some text (nothing unusual) but we need to know how often (or how rare) each letter 

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

Step by Step Solution

3.48 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Answer Function to count Latin letters in a text def countlatinletterstext lette... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!