If the line number provided by the user is not numeric


This program should be written in PYTHON: add error checking (Raising and Handling Exception):

1. Program should handle file not found exception, if the input file does not exist

2. Program should raise an exception if the file is empty

3. If the line number provided by the user is not numeric, program should handle the conversion exception

4. If the line number provided is greater than the number of lines in the file, the program should raise a ValueError exception.

Note: This may cause the program to exit 5. Write a program that allows the user to navigate the lines of text in a file.

The program should prompt the user for a filename. The program should use a function, loadData, to accomplish the following:

Load the file content into a dictionary, fileContent, which will contain each line and its corresponding line number.

The function should also populate a second dictionary, fileInfo, with each word in the file and the number of times each word appears in the file. Once the loadData function completes, the program will print the contents of fileInfo dictionary; each word and its count appearing on a separate line.

The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers range from 1 to the number of lines in the file. If the input is 0, the program quits. Otherwise, the program prints the line (text) associated with that line number.

Note: The loadData function take one argument, the name of the file. your function name must be loadData which should include all code that uses dictionary fileContent fileInfo to save number of line and word frequency

Your code is should include dictionary fileContent that stores number of line that counted. You code is should include dictionary fileInfo that stores words' frequency and prints it .

Your loop supposed to be working with fileContent which has number of line as key.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: If the line number provided by the user is not numeric
Reference No:- TGS02900827

Expected delivery within 24 Hours