Question: This should be written in Python. This program is supposed to compare the correct answers to the student answers and then return 1. How many

This should be written in Python. This program is supposed to compare the correct answers to the student answers and then return

1. How many the student got correct

2. how many the student got incorrect

3. The list of the numbers of the questions the student got incorrect

Here is what I have so far:

def main():

# Create correct answer list(DMV_answers). DMV_Answers = ['A', 'C', 'A', 'A', 'D', 'B', 'C', 'A', 'C', 'B', 'A', 'D', 'C', 'A', 'D', 'C', 'B', 'B', 'D', 'A']

# Open Student Answers file. Student_infile = open('StudentAnswers.txt', 'r') # Read the file into a list. Student_Answers = Student_infile.readlines() # Close the file. Student_infile.close()

# Strip the /n. index = 0 while index < len(Student_Answers): Student_Answers[index] = Student_Answers[index].rstrip(' ') # So Student_Answers is my student list index += 1

Processing(DMV_Answers,Student_Answers)

def Processing(DMV_Answers,Student_Answers): correct_answer = 0 incorrect_answer = 0 wrong_list = [ ]

for i in range(len(DMV_Answers)): if Student_Answers == DMV_Answers: # ??? is this DMV(index 0) and Student(index 0). if so how correct_answer += 1 else: wrong_list.append(Student_Answers) incorrect_answer += 1 print(i) if correct_answer > 14: print('You Passed') else: print('You Failed') # print('correct answers = ', correct_answer) # print('incorrect answers = ', incorrect_answer) # print(wrong_list) I can't figure out why my output is wrong.

main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!