Answered You can hire a professional tutor to get the answer.

QUESTION

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 ru

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 50
  • 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 : 204and : 340as : 54at : 75be : 58been : 51but : 62for : 66had : 200he : 102her : 129his : 80

......

Show more
Files: input.txt
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question