Answered step by step
Verified Expert Solution
Question
1 Approved Answer
All the codes need to have proper comments and explanation. Please show the screen shots for the output. 1. From the provided input text
All the codes need to have proper comments and explanation. Please show the screen shots for the output. 1. From the provided input text file "File_to_be_read.txt" please perform the following mentioned tasks. A. Read the data from the input file using a try and catch block and using with keyword, scan through the entire file and count the number of occurrences of each word and write the data into a new file with name as "output1.txt". Below is sample output file: He:8 pointed:1 his:8 finger:1 in:5 friendly:1 jest:1 and:10 went:2 over:5 to:11 the:17 B. Read the data from the input file using a try and catch block and using with keyword, scan through each line of the file and count the length of each word and write the data into a new text file "output2.txt". Below is sample output file: He,2 pointed,7 his,3 finger,6 in,2 friendly,8 jest,4 and,3 went,4 over,4 to,2 Please close the main file and make sure you code for error handling.
Step by Step Solution
★★★★★
3.36 Rating (177 Votes )
There are 3 Steps involved in it
Step: 1
A counts dict Dictionary to store the word and its corresponding ...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