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

2. The school office has asked you to create an application that grades the exam

ID: 3583409 • Letter: 2

Question

2. The school office has asked you to create an application that grades the exam. The exam has 20 multiple-choice questions. Here are the correct answers: 9. D 13. B 5. C 1. C 6. C 10. C 14. A 18. B 2. A 7. A 1. C 3. D 19. A 15. C 8, B 12, A 4. B 16. D 20. C Your program should store these correct answers in a list. The program should read the student's answers for each of 20 questions from a text file (You should name the txt file student exam.txt. You need to create your own file to test the application) and store the answers in another list. After the

Explanation / Answer

Answer

Below is the required python code:

ans_list = ["C", "A", "D", "B", "C", "C", "A", "B", "D", "C", "C", "A", "B", "C", "D", "B", "B", "A", "C"]
fname = "student_exam.txt"
count = 0
ind = 0
incor_list = []
with open(fname) as f:
   stud_grad = f.readline()
   if ans_list[ind] == stud_grad:
       count++
       ind++
   else:
       incor_list.append(ind+1)
       ind++

if count >= 15:
   print "Student has passed the exam. "
print "The total number of correct answer is ::", count
print "The list of question numbers of which incorrect answers were given :: ", incor_list

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote