Question
PYTHON: Your program will take a file name from user and find out occurrences of characters (only alpha numeric characters) in the file. Upper and
PYTHON:
Your program will take a file name from user and find out occurrences of characters (only alpha numeric characters) in the file. Upper and lower characters need to be counted as same characters for this assignment. You need to use Python Dictionary and tuples for this assignment. Your output should be sorted ascending order of frequencies. Do not use "Read" method to read the entire file in.
If user enters wrong information (wrong name of the file or non-existing file name), your program needs to display message and ask for correct input. Your program should not generate traceback message with any input. Write comment for program.
Sample files:
sample10-1.txt
Ch10-data2.txt
OUTPUT:
Please enter 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 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.
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