Question: Python 3.5 You are required to complete the read_solution() function. If the first option of the menu, i.e., Read a Solution , is selected, the
Python 3.5
You are required to complete the read_solution() function. If the first option of the menu, i.e., Read a Solution, is selected, the program should allow the user to type in a file name for reading a list of answer keys. If the file exists you can print out a confirmation message. If the file doesn't exist you should tell the user that the file cannot be found and display the main menu again. The function should return the list of answer keys. Note that the function should also print the list of answer keys for our marking purpose.
Here's a sample running of this section with an invalid filename:
Enter your choice: 1 --------------------------------------------------- Enter name of the solution file: out.txt File out.txt could not be opened --------------------------------------------------- ... 6. Quit the program --------------------------------------------------- Enter your choice:
Here's a sample running of this section with a valid filename:
Enter your choice: 1 --------------------------------------------------- Enter name of the solution file: solution.txt Completed reading of file solution.txt ['B', 'D', 'D', 'B', 'D', 'C', 'D', 'B', 'A', 'B', 'D', 'C', 'A', 'B', 'D'] --------------------------------------------------- ... 6. Quit the program --------------------------------------------------- Enter your choice:
================================================
def read_solution(): #This function ...
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
