Write a python script that counts occurrences of words in a


Quesiton: Write a python script that counts occurrences of words in a file.

• The script expects two command-line arguments: the name of an input file and a threshold (an integer). Here is an example of how to run the script (assuming that it is named words_occurrences_counter):words_occurrences_counter input.txt

• The input file contains exactly one word per line, with no whitespace before or after the word. The script does not need to verify the contents of the input file.

• The letter case of words in the input file does not matter for counting. For example, the script should count "the", "The", and "THE" as the same word.

• After counting the words, the script prints a report (to a file, output.txt) that lists the words and their counts. Each word is printed only if its count is greater than or equal to the threshold given on the command line.

Input File

Download the sample data file input.txt . Keep in mind that this is just one data file, and that your program should work correctly on all files in the format described above.You may use the starter code(starter_code.py ) if you want.

Output file

Example,

a : 204

and : 340

as : 54

at : 75

be : 58

been : 51

but : 62

for : 66

had : 200

he : 102

her : 129

his : 80

Information related to above question is enclosed below:

Attachment:- Files.rar

Solution Preview :

Prepared by a verified Expert
Python Programming: Write a python script that counts occurrences of words in a
Reference No:- TGS02935245

Now Priced at $50 (50% Discount)

Recommended (93%)

Rated (4.5/5)