Computer Science, asked by jsheela367, 6 hours ago

write a program that reads a file and builds a histogram of the words in the file.​

Answers

Answered by kanchankumari028
2

Answer:

Write a program that reads in the contents of a text file and displays a histogram of the frequency that words appear in the text. Requirements: - Prompt the user to enter the filename of a text file - Read the contents of that text file and count the number of times each word appears in the file - Store the words and associated counts in a dictionary as key-value pairs - Display a histogram using asterisks representing the frequency that the words in the file appear Notes: Make the program case-insensitive (so ‘The’ is considered the same word as ‘the’), and punctuation marks should be replaced with spaces prior to counting the words. See example below, which can be incorporated into your program:

Similar questions