Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python, using IDLE. The specifications for this program at end of chapter 7 your

ID: 3917951 • Letter: P

Question

Python, using IDLE.

The specifications for this program at end of chapter 7 your text: The "Drivers License Exam" program.

The correct answers for the test will be stored in your program as a list, such as the one below. In fact, you may use the code below in your program:

correct_answers = ['A', 'C', 'A', 'A', 'D', 'B', 'C', 'A', 'C', 'B', 'A', 'D', 'C', 'A', 'D', 'C', 'B', 'B', 'D', 'A']

The test taker's answers will be stored in a file called "student_answers.txt" - a sample is below. Your program will read the answers from the "answers.txt" file and store them in a list, and then compare them with the answers in the "correct_answers" list, and perform the analysis required by the specifications (tell the examinee if they passed or failed (15 of 20 questions is required to pass); how many questions they answered correctly, how many incorrect, and a list of the question numbers of incorrectly answered questions.

Other: Compute the score for the test (number correct divided by number of questions) show with percent sign.

Include your name in comments in the code, and also as the name of the examinee in the output.

Example output:

Name of Examinee: your name (e.g., "Angela Cruz")

Score: 80.0%

Congratulation, you passed the exam! (or "Sorry, you did not pass the exam this time")

Number correct: 16

Number incorrect: 4

Questions missed: 2, 6, 7, 15

sample test file: attached

==============

Other: use a try...except block in the code to trap file not found situations

Student_answers.txt:
A
D
A
A
D
D
D
A
C
B
A
D
C
A
C
C
B
B
D
A

Explanation / Answer

correct_answers = ['A', 'C', 'A', 'A', 'D', 'B', 'C', 'A', 'C', 'B', 'A', 'D', 'C', 'A', 'D', 'C', 'B', 'B', 'D', 'A'] name = input('Name of Examine: ') try: answers = [] with open('Student_answers.txt', 'r') as f: for line in f: answers.append(line.strip()) incorrect_list = [] for i in range(len(correct_answers)): if answers[i] != correct_answers[i]: incorrect_list.append(str(i+1)) score = ((len(correct_answers) - len(incorrect_list)) * 100) / len(correct_answers) print('Score: ' + str(score) + '%') if len(correct_answers) - len(incorrect_list) >= 15: print('Congratulation, you passed the exam!') else: print('Sorry, you did not pass the exam this time') print('Number correct: ' + str(len(correct_answers) - len(incorrect_list))) print('Number incorrect: ' + str(len(incorrect_list))) print('Questions missed: ' + ', '.join(incorrect_list)) except: print('Failed to open Student_answers.txt to read')