Question: CREATE PYTHON PROGRAM You are creating a program using Python that opens and reads a file. Your program opens a file that is named .txt.
CREATE PYTHON PROGRAM
You are creating a program using Python that opens and reads a file. Your program opens a file that is named .txt. Your program will display a menu that allows a user to choose how to process the file.
Write a program that:
- Opens a file.
- Prompts a user with a menu of choices.
- User makes a choice.
- If one is chosen - the program counts the number of words in the novel.
- If two is chosen - the program prompts for a word to search for. It returns the number of instances of that word.
- if three is chosen - the program returns a secret message that is embedded in the file delimited by @s.
- if four is chosen, close the output file and program exits.
- The menu will continue to display as long as four is not entered.
- Define a function called display_menu()
- displays a menu
- returns the option chosen.
- Define a function called get_word_count()
- resets handle_input
- reads every record in the file
- counts every word in the record
- adds count to a total count
- returns the total count
- Define a function called get_specific_count()
- resets handle_input
- reads every record in the file
- looks to match the word and counts the matches
- Define a function called find_message()
- resets handle_input
- finds a message embedded between 2 @s

Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
