Create a program that analyzes a text file and counts

profileadelen
 (Not rated)
 (Not rated)
Chat

Part1

Create a program that analyzes a text file and counts how many time various words are used within it.

User flow

▪   The program asks a user what file to open.

▪   The program then asks the user to enter a comma-separated list of words to analyze within the file.

▪   The program then outputs the frequency of each word within the file.

Sample session

User responses are bold.

 

What file would you like to open? universal_declaration_of_human_rights_in_nigerian_pidgin_english.txt

What words would you like to search for? wey, dem, unifasiti, ting

 

... analyzing ... hold on ...

 

Frequency of word usage within universal_declaration_of_human_rights_in_nigerian_pidgin_english.txt:

    wey               /  19 occurrences

    dem              /  17 occurrences

    unifasiti        /  22 occurrences

    ting              /  63 occurrences

Requirements

▪   Include a sample text file along with your code when submitting your assignment. Package both files into a zip file.

▪   If the user includes spaces in their list of words (as I have done in the example session above), they should be stripped out and ignored.

▪   capitalization should be ignored.

▪   there is no limit to how many words the user can enter.

 

Part2

Do the assignment without using Python's built-in String count() method.

 

    • 11 years ago
    the answer
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      new556.zip