The financial Impact of Structural Racism in Private and Public Prisons
August 20, 2020
..
August 20, 2020
Show all

Python Grade Assignment

Your math teacher has asked you to write a program that grades the multiple-choice questions in a Math exam. The exam has 10 multiple-choice questions. Here are the correct answers:

1. A        6. B       

2.D          7.A       

3. B          8. B     

4.B          9.C       

5.C          10.D     

Your program should store the correct answers shown above in a list. It should ask the student to enter her answers for each of the 10 questions, and the answers should be stored in another list. After the students answers have been entered, the program should display a message indicating whether the student passed or failed the exam. (A student must correctly at least answer 7 of the 10 questions to pass the exam.) It should then display the total number of correctly answered questions, the total number of incorrectly answered questions. Your program must have at least the following functions:

getInput(inputList)
checkAnswers(userlist, correctAnswerList, rightQuestions, wrongQuestions)
*. The getInput function accepts a list and asks the user to input answers to the exam and stores them in the list. You must have an Input Validation loop: Only accept the letters A, B, C, D or a, b, c, d, as answers.

*. The checkAnswers function receives 4 parameters; the student’s answers the correct answers and an empty list for the student’s right answers and an empty list for the student’s wrong answers.

It compares the values in the correct answers list to the values of the student’s list. It updates the student’s right answers list and the student’s wrong answers list. it returns the number of correct answers to the main function.

sample run:

Enter the answers for each of the questions.
Question1:A
Question2:D
Question3:B
Question4:b
Question5:c
Question6:b
Question7:v
Enter only an A, B, C, D or a,b, c, d for each question.
Question7d
Question8:c
Question9:b
Question10:D
You have 3 answers wrong.

You have 7 answers right.
The wrong questions are: [7, 8, 9]
The right questions are: [1, 2, 3, 4, 5, 6, 10]

You passed the exam.

Leave a Reply

Your email address will not be published. Required fields are marked *