Write a function called generate?frequency?table?ilename) which accepts the name of a text file and returns a dictionary
Question:
Write a function called generate?frequency?table?ilename) which accepts the name of a text file and returns a dictionary containing the frequency of all the letters that appear in the file. For purposes of the frequency count, any non-letter characters are ignored, and the difference between upper and lower case letters is ignored (i.e., treat all letters as lower case).
You may wish to break the task up further and use several smaller functions to achieve this task. For example, it might be convenient to have functions to perform each of the following tasks:
? Read and return the contents of a text file
? Remove all non-letter characters from a given string
? Perform a frequency count of letters in a given string
The string class has an attribute called ascii_letters which is a string containing all the letters. You can access that string using:
Discovering Advanced Algebra An Investigative Approach
ISBN: 978-1559539845
1st edition
Authors: Jerald Murdock, Ellen Kamischke, Eric Kamischke