Write a Python program that reads each line of an input file original.txt and saves in a file called analysis.txt the line number, the number of words and characters found in that line without counting punctuations separating the words or found at the end of the line. For example, if the original.txt file is: In COMP2101, the students learn basic programming skills. Which includes: arithmetic and logical expressions, decisions, and loops. They will also learn how to read and write from keyboards and files. The file analysis.txt will contain Line1, 8 words and 48 characters Line2, 9 words and 61 characters Line 3, 13 words and 55 characters

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section8.5: A Case Study: Pollen Count File Update
Problem 3E
icon
Related questions
Question
Exercise 5:
Write a Python program that reads each line of an input file original.txt and saves in a file called
analysis.txt the line number, the number of words and characters found in that line without counting
punctuations separating the words or found at the end of the line. For example, if the original.txt file
is:
In COMP2101, the students learn basic programming skills.
Which includes: arithmetic and logical expressions, decisions, and loops.
They will also learn how to read and write from keyboards and files.
The file analysis.txt will contain
Line1, 8 words and 48 characters
Line2, 9 words and 61 characters
Line 3, 13 words and 55 characters
Transcribed Image Text:Exercise 5: Write a Python program that reads each line of an input file original.txt and saves in a file called analysis.txt the line number, the number of words and characters found in that line without counting punctuations separating the words or found at the end of the line. For example, if the original.txt file is: In COMP2101, the students learn basic programming skills. Which includes: arithmetic and logical expressions, decisions, and loops. They will also learn how to read and write from keyboards and files. The file analysis.txt will contain Line1, 8 words and 48 characters Line2, 9 words and 61 characters Line 3, 13 words and 55 characters
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT