Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a file words.txt that contains a paragraph of random words (approximately 100 words long). Next, create a program that prompts for the file
Create a file words.txt that contains a paragraph of random words (approximately 100 words long). Next, create a program that prompts for the file name then iterates through each word in this file and counts the frequency of each letter (a through z) and stores the values in a dictionary. Make each letter lowercased and ignore punctuation. Print a histogram of the word counts. You may use "words.txt" included with this assignment. Hints: Python provides a module that stores various groups of characters as a string. If you import the string module, you will see that it contains a number of predefined strings, including: string.punctuation: '!"#$%&\'()*+,-./:; ?@[\\]^_`\{\}" || string.digits: '0123456789' string.ascii.lowercase: 'abcdefghijklmnopqrstuvwxxZ
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