Question
Write a function in Python 3 that reads the contents of a text file. The function should create a dictionary in which the keys are
Write a function in Python 3 that reads the contents of a text file. The function should create a dictionary in which the keys are the individual words from the file, and the values are the number of times each word appears in the file. The main program should ask the user for the name of the file to read, pass that name to the function, and get the dictionary returned from the function. Main should display the word / frequency pairs in alphabetical order one per line. Also display the most frequently used word and the number of times it was used.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started