PYTHON:
Your program will take a file name from the user and find out occurrences of characters (only alphanumeric characters) in the file. Upper and lower characters need to be counted as the same characters for this assignment. You need to use Python Dictionary and tuples for this assignment. Your output should be sorted in ascending order of frequencies. Do not use the "Read" method to read the entire file in.
If the user enters wrong information (wrong name of the file or non-existing file name), your program needs to display a message and ask for correct input. Your program should not generate a traceback message with any input. Write a comment for the program.
Sample files:
sample10-1.txt
Ch10-data2.txt
OUTPUT:
Please enter the file name to process: sample10-1.txt
[(1, 'b'), (1, 'm'), (1, 'v'), (1, 'x'), (1, 'y'), (3, 'g'), (3, 'w'), (4, 'c'), (6, 'd'), (6, 'f'), (6, 'u'), (11, 'p'), (13, 'r'), (14, 's'), (15, 'i'), (15, 'n'), (16, 'a'), (17, 'h'), (17, 'l'), (25, 't'), (30, 'o'), (33, 'e')]
Do you want to try another file? (y or n) y
Please enter the file name to process: Ch10-data2.txt
[(2, 'x'), (4, 'v'), (4, 'y'), (5, 'b'), (7, 'c'), (7, 'k'), (8, 'p'), (9, 'g'), (10, 'f'), (10, 'm'), (10, 'w'), (13, 'd'), (14, 'l'), (14, 'r'), (15, 'h'), (16, 'u'), (17, 's'), (18, 'i'), (22, 'a'), (26, 'n'), (27, 'o'), (36, 't'), (40, 'e')]
Do you want to try another file? (y or n) n
Thank you for playing.