I Write a program which does the following: 1) Prompt the user for a file name....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
I Write a program which does the following: 1) Prompt the user for a file name. 2) Read in the file line by line a) Be sure to catch any exceptions that happen, for example if the file doesn't exist. 3) Split each line into words (Hint: Words have spaces before and after them) 4) Split each line into characters a) Count the characters. Note: spaces, periods, commas are not characters. 5) Keep track of the total number of lines, words and characters. 6) Be sure to close out your file correctly. 7) Print out the total number of Lines, Words and Characters. I Write a program which does the following: 1) Prompt the user for a file name. 2) Read in the file line by line a) Be sure to catch any exceptions that happen, for example if the file doesn't exist. 3) Split each line into words (Hint: Words have spaces before and after them) 4) Split each line into characters a) Count the characters. Note: spaces, periods, commas are not characters. 5) Keep track of the total number of lines, words and characters. 6) Be sure to close out your file correctly. 7) Print out the total number of Lines, Words and Characters.
Expert Answer:
Answer rating: 100% (QA)
Here is a simple Introduction The following Python program prompts the user for a file name reads it line by line and calculates the total number of lines words and characters handling exceptions appr... 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
-
installment note, with semiannual interest payments. 1) Calculate the amount of each payment using the PMT function. 2) Prepare the amortization schedule for the loan. Enter a valid Excel formula or...
-
Lab 10: ArrayLists and Files in a GUI Application For this lab, you will work on a simple GUI application. The starting point for your work consists of four files (TextCollage, DrawTextItem,...
-
For this lab, you will work on a simple GUI application. The starting point for your work consists of four files (TextCollage, DrawTextItem, DrawTextPanel, and SimpleFileChooser) in the code...
-
Write a program Tree that takes a command-line argument n and produces the following recursive patterns for n equal to 1, 2, 3, 4, and 8. So b b b h l 4 3 2 1
-
Are manufacturing or purchasing lead times considered in the MPS and the MRP? Discuss.
-
What do you see as the primary advantage of using big data analytics-understanding the environment or influencing the environment? Why?
-
What is meant by user-oriented systems design?
-
The following data were extracted from the accounting records of Meniscus Company for the year ended April 30, 2006: Merchandise inventory, May 1, 2005 ....... $ 121,200 Merchandise inventory, April...
-
Cash Accounts receivable Inventory Store equipment Accumulated depreciation Accounts payable Line of credit loan Common stock Retained earnings Totals $ 17,500 63,000 41,500 230,000 $ 77,400 73,500...
-
You have been hired as a new accountant for Bake-Me-Some-Bread, Inc. They have asked you to calculate the company's Manufacturing Overhead Rate. You are given the following data from the accounting...
-
8. Evaluate: S 2 3et dt + 9 Round your answer to four decimal places.
-
Bramble Corp. traded machinery with a book value of $764500 and a fair value of $695000. It received in exchange from Cullumber Company a machine with a fair value of $822000. Bramble also paid cash...
-
determine the specific volume of compressed liquid water at 185 degree celsius and 0.5mpa
-
On Windows, remain on the Processes tab. Programs send data to storage even when you are not in the process of manually saving files. Some programs create autorecovery files as temporary backups, and...
-
Suggest a job description summary for a food service manager for the following: We're looking for an experienced Food Service Manager who can efficiently manage and supervise the daily food service...
-
What is the objective of liquidity ratios? Measure how effectively a company is using it assets to generate profits Measure an organization's ability to meet its current debt obligations Examine the...
-
ABC Transformer Corporation, a leading manufacturer of power transformers for the North American utility market based in Ontario, today announced the acquisition of the South American brand, designs...
-
What types of inventory issues Starbucks might reflect upon at the end of each year? The mission of Starbucks is to inspire and nurture the human spiritone person, one cup, and one neighborhood at a...
-
Ray and Maria Gomez have been married 3 years. They live at 1610 Quince Ave., McAllen, TX 78701. Ray works for Palm Oil Corporation and Maria works for the City of McAllen. Maria's Social Security...
-
Mallory Corporation has a calendar year-end. The corporation has paid estimated payments of $10,000 during 2012 but still owes an additional $5,000 for its 2012 tax year. a. When is the 2012 tax...
-
Yolanda earns $112,000 in 2012. Calculate the FICA tax that must be paid by: Yolanda:.....................Soc.Sec..................$__________...
-
Use the comparative statements from Application Problem 17-1 to complete this problem. Instructions: 1. Based on CyberOptic's comparative financial statements prepared in Application Problem 17-1 and...
-
Use the comparative balance sheet from Application Problem 17-1 to complete this problem. Instructions: 1. Based on CyberOptics comparative balance sheet prepared in Application Problem 17-1,...
-
Use the comparative statements from Application Problem 17-1 to complete this problem. Instructions: 1. Based on CyberOptics comparative financial statements prepared in Application Problem 17-1 and...
Study smarter with the SolutionInn App