Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that counts the number of characters, words, and lines in a given file. Whitespace characters' separate words. The followings are required:
Write a program that counts the number of characters, words, and lines in a given file. Whitespace characters' separate words. The followings are required: a. The program should prompt the user to enter file name b. The program should read the file name from keyboard c. Make sure that the data file exists prior to reading it d. The program read the file contents and count the number of characters, words and lines the file has. The following diagram shows a sample of the program when it runs and read file Please enter file to be processed: test Document.txt Does the file exist in the system? YES Processing File test Document.txt 3087 Characters 476 words 83 Lines
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Answer Certainly Below is a simple Python program that fulfills the specified requirements This prog...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started