Write a main function that prompts for a file name and counts the frequency of each...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a main function that prompts for a file name and counts the frequency of each letter (a through z) using a dictionary. Make each letter lowercased and ignore punctuation. Print a histogram of the word counts. Use string format method to format the table as shown below. You may use USConstitution.txt file, included with this assignment, to test your program. Here is a sample run: Enter file name USConstitution.txt letter count 2075 437 938 914 3711 a b QUO SECOPUS DE XAN с d e g h i j k 1 m n р q r t u V W 720 340 1428 1702 84 45 1112 578 1983 1956 495 32 1525 1991 2667 741 314 281 88 378 17 Write a main function that prompts for a file name and counts the frequency of each letter (a through z) using a dictionary. Make each letter lowercased and ignore punctuation. Print a histogram of the word counts. Use string format method to format the table as shown below. You may use USConstitution.txt file, included with this assignment, to test your program. Here is a sample run: Enter file name USConstitution.txt letter count 2075 437 938 914 3711 a b QUO SECOPUS DE XAN с d e g h i j k 1 m n р q r t u V W 720 340 1428 1702 84 45 1112 578 1983 1956 495 32 1525 1991 2667 741 314 281 88 378 17
Expert Answer:
Answer rating: 100% (QA)
Below is a Python program that accomplishes the task described It prompts the user for a file name r... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
The business accounts for VAT on a two-monthly basis. REQUIRED: Calculate the final amount payable to SARS on 31 July 2023. (You may prepare a VAT Control Account to assist in your calculations)....
-
if we choose statistic as our keyword, our cipher would be determined as follows: method i. write the word statistic without the repeated letters. then complete the cipher with the unused alphabet...
-
How is it that a state, or any state, such as Oregon, can offer more provisions under FMLA (OFLA) than then the federal rule of FMLA does?
-
Peter Cook, CPA, was asked by Carol Kane to review the accounting records and prepare the financial statements for her upholstering shop. Peter reviewed the records and found three errors. 1. Cash...
-
Grades assigned by an economics instructor have historically followed a symmetrical distribution: 5% As, 25% Bs, 40% Cs, 25% Ds and 5% Fs. This year, a sample of 150 grades was drawn and the grades...
-
Define what use case modeling is and is not.
-
Financial statements for Allendale Company follow: ALLENDALE COMPANY Balance Sheets As of December 31 2019 2018 Assets Current assets Cash $ 40,000 $ 36,000 Marketable securities 20,000 6,000...
-
Below is an adjusted trial balance for Wyndham Whole Company for the month ended Aug. 31, 2024. Account Title Debits Credits Cash Accounts receivable Prepaid rent Inventory $23,000 25,000 4,000...
-
The following adjusted revenue and expense accounts appeared in the accounting records of Pashi, Inc., an accrual basis taxpayer, for the year ended December 31, Year 2. Revenues Net sales $3,000,000...
-
Below are four bivariate data sets and the scatter plot for each. (Note that each scatter plot is displayed on the same scale.) Each data set is made up of sample values drawn from a population. y V...
-
The management of Brawn Engineering is considering three alternatives to satisfy an OSHA requirement for safety gates in the machine shop. Each gate will completely satisfy the requirement, so no...
-
A new integrated circuit board is being developed for use in computers. In the early stages of development, a lack of quality control results in a 0.2 probability that a manufactured integrated...
-
If six people are randomly selected, find the probability that none of them has brown eyes. Assume that 40% of the population has brown eyes based on data from Dr. P. Sorita at Indiana University.
-
Show that the Fourier transform of an imaginary and odd sequence is real and odd.
-
Show that the Fourier transform of a conjugate antisymmetric sequence is imaginary.
-
Han Products manufactures 32.000 units of part S-6 each year for use on its production line At this level of activity. the cost per unit for part S-6 Direct materials Direct labor Variable manuf...
-
A Firm intends to invest some capital for a period of 15 years; the Firm's Management considers three Options, each consisting of purchasing a machinery of a specific brand, different for each...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family. The Incisors own a rental beach house in Hawaii. The beach house was rented for the full year during 2012...
-
Sally hires a maid to work in her home for $250 per month. The maid is 25 years old and not related to Sally. During 2012, the maid worked 10 months for Sally. a. What is the amount of Social...
-
On September 14, 2012, Jay purchased a passenger automobile that is used 75 percent in his accounting business. The automobile has a basis for depreciation purposes of $35,000, and Jay uses the...
-
Consider an experiment that selects a cell phone camera and records the recycle time of a flash (the time taken to ready the camera for another flash). The possible values for this time depend on the...
-
Suppose that the recycle times of two cameras are recorded. The extension of the positive real line \(R\) is to take the sample space to be the positive quadrant of the plane \[ S=R^{+} \times R^{+}...
-
As in Example 2.1, camera recycle times might use the sample space \(S=R^{+}\), the set of positive real numbers. Let \[ E_{1}=\{x \mid 10 \leq x <12\} \quad \text { and } \quad E_{2}=\{x \mid 11 0\}...
Study smarter with the SolutionInn App