Question: Write a program that asks for the name of the file to read then reads the contents of a text file. The program should create

Write a program that asks for the name of the file to read then reads the contents of a text file. The program should create a dictionary in which the keys are the individual words found in the file and the values are the number of times each word appears. For example, if the word "when" appears 4 times (regardless of case), the dictionary would contain an element with 'when' as the key and 4 as the value. The program should then display the frequency of each word (ascending order) from the dictionary. Text file for the program:
text.txt
When the sun goes down we'll be groovin'
When the sun goes down we'll feel alright
When the sun sinks down over the water
Everything gets hotter when the sun goes down
Write a program that asks for the name of the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!