Question: Write a PYTHON 3 module with a function to determine the 5 most common words in a string using a dictionary. Your function should take
Write a PYTHON 3 module with a function to determine the 5 most common words in a string using a dictionary. Your function should take a string as a parameter and return a list of the 5 most common words in that string. Within the main body of your code, define a tuple of at least 4 text passages, each of which should have 6 or more sentences. Use any sample texts youd like quotes from your favorite books/movies/TV shows, excerpts from famous speeches, etc. just look them up on Google and copy and paste.
Your program should print out a menu to the user with the titles of the passages in your tuple (consider using another function to do this) and allow them to select which excerpt to count the common words in. Then, call your function with the chosen text passed in as an argument, and print out the returned value of the 5 most common words in the text. Finally, allow the user to choose whether or not to pick another text to analyze. If they choose yes, print out the menu again and repeat. If not, end the program.
Please fill with comment and make it easy to follow. Please make it easy for a beginner using python.
Do not use parallel arrays or anything advanced please.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
