Question: USING PYTHON HOW CAN I SOLVE THIS ON ANY FILE (file.txt) 1- Compute the number of words in the file. [words are strings separated by

USING PYTHON HOW CAN I SOLVE THIS ON ANY FILE (file.txt)

1- Compute the number of words in the file. [words are strings separated by spaces]

2- Compute the number of lines in the file.

4- For each word in the file, compute the length of the word.

5- Compute the average word length.

6- Compute the number of different words in the file. (use sets)

7- Store the different words (as computed in 6) into a binary file where each word is stored in a separate line with its frequency (i.e. how many times a certain word occurred in the file).

8- Use CSV files to store the words, in the same order as they occurred in the article, with the length of the word.

Note: use exception handling in your program where ever it is needed.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!