Question
write a python function store_frequencies_alphabetically(frequencies, freq_file_name) which writes the frequencies from any list of string-frequency pairs into a new alphabetically sorted file with the name
write a python function store_frequencies_alphabetically(frequencies, freq_file_name) which writes the frequencies from any list of string-frequency pairs into a new alphabetically sorted file with the name freq_file_name), in the same format as the file you read the frequencies from. In order to make the output cleaner, only the prefixes which occurred 1000 times or more are supposed to be written to the file. Use the function to save the result of your prefix frequency computations into a new file with name freq_en_prefixes.txt. If you did everything correctly, the first few lines of your result file should look like this: a 45546869 aa 55975 aaa 7478 aaaa 2175 aaaah 1092 aaah 3973 aah 35842 aar 9254 aaro 7657 aaron 7657
def store_frequencies_alphabetically(frequencies, freq_file_name): """ Writes a list of (string,frequency) pairs to a new file, with string in alphabetical order. Each pair is only written if frequency >= 1000. """
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