Question

PYTHON Driver’s License The local driver’s license office has asked you to create an application that...

PYTHON

Driver’s License

The local driver’s license office has asked you to create an application that grades the written portion of the driver’s license. The paper has 20 multiple-choice questions. Here are the correct answers:

  1. A
  2. C
  3. A
  4. A
  5. D
  6. B
  7. C
  8. A
  9. C
  10. B
  11. A
  12. D
  13. C
  14. A
  15. D
  16. C
  17. B
  18. B
  19. D
  20. A

Your program should store these correct answers in a list. The program should read the student’s answers for each of the 20 questions from a text file and store the answers in another list. (Create your own text file to test the application.) After the student’s answers have been read from the file, the program should display a message indicating whether the student pass or failed. (A student must correctly answer 15 of the 20 questions to pass.) It should then display the total number of correctly answered questions, the total number of incorrectly answered questions, and a list showing the question numbers of the incorrectly answered questions.

Homework Answers

Answer #1

Hey mate, the Python code for above program is provided below with sample output. Do refer the screenshot of the code for proper indentation and error free execution.

SAMPLE TEXT FILE ( that stores student's answers ) -

MAIN PROGRAM -

# list of correct answers
correct_Answers=['A','C','A','A','D','B','C','A','C','B','A','D','C','A','D','C','B','B','D','A']

# opening text file that stores student's answers 
txtFile=open("answers.txt")

i=0
marks=0
student_Answers=list()
incorrect_Answers=list()

# reading student's answers from student.txt and storing in separate list
for line in txtFile:
    student_Answers.append(line.strip())

# validating the answers in each list and storing question numbers of incorrect answers in separate list
for answer in student_Answers:
    if(answer==correct_Answers[i]):
        marks=marks+1
    else:
        incorrect_Answers.append(i+1)
    i=i+1

# printing overall result    
if(marks>=15):
    print("\nResult: Student is Passed!")

else:
    print("\nResult: Student is Failed!")

print("\nTotal number of correctly answered questions: ",marks)
print("Total number of incorrectly answered questions: ",(20-marks))
print("List of question numbers answered incorrectly: ",incorrect_Answers)

# closing the file to free up memory space
txtFile.close()

OUTPUT -

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
--USING C# ONLY-- You will create your own on-line shopping store in the console application. You...
--USING C# ONLY-- You will create your own on-line shopping store in the console application. You can choose different products to sell in your store (at least 8 products). You will create an product inventory text file. The program will display two options at the beginning of the program, Customer and Manager. Customer: If this is a new customer, the program will allow the customer to register with their information and assign a unique ID number to the new customer....
A quiz consists of 15 multiple-choice questions. Each question has 5 choices, with exactly one correct...
A quiz consists of 15 multiple-choice questions. Each question has 5 choices, with exactly one correct choice. A student, totally unprepared for the quiz, guesses on each of the 15 questions. a. How many questions should the student expect to answer correctly? b. What is the standard deviation of the number of questions answered correctly? c. If at least 7 questions must be answered correctly to pass the quiz, what is the chance the student passes?
A group of statisticians at a local college has asked you to create a set of...
A group of statisticians at a local college has asked you to create a set of functions that compute the median and mode of a set of numbers, as defined in Section 5.4. Define these functions in a module named stats.py. Also include a function named mean, which computes the average of a set of numbers. Each function should expect a list of numbers as an argument and return a single number. Each function should return 0 if the list...
A teacher gives a student a make-up test consisting of 20 true-false questions. The intent of...
A teacher gives a student a make-up test consisting of 20 true-false questions. The intent of the test is to determine whether the student answers the questions correctly through knowledge of the material or merely by making lucky guesses. Assume the correct answers are a random sequence of “true” and “false” and that the student’s guesses are also random. a. State a null hypothesis based on the probability of guessing the correct answer to a question. b. State a one-tailed...
Due to pressing social commitments, a student, was not able to study for an examination. The...
Due to pressing social commitments, a student, was not able to study for an examination. The examination consists of 4 multiple choice questions. Each question has 6 possible answers from which to choose, only one of which is correct. The student plans to answer the questions randomly by rolling a fair die for each question and choosing the response associated with the number rolled. Let X denote the number of questions correctly answered by the student. a)      What is the probability...
C# Step 1: Create a Windows Forms Application. Step 2: Create a BankAccount class. Include: Private...
C# Step 1: Create a Windows Forms Application. Step 2: Create a BankAccount class. Include: Private data fields to store the account holder's name and the account balance A constructor with 0 arguments A constructor with 1 argument (account holder's name) A constructor with 2 arguments(account holder's name and account balance) Public properties for the account holder's name and the account balance. Do not use auto-implemented properties. A method to increase the balance (deposit) A method to decrease the balance...
A student is taking a multiple-choice quiz in which each question has five possible answers, exactly...
A student is taking a multiple-choice quiz in which each question has five possible answers, exactly one of which is correct. He knows 85% of the material being tested. Assume the teacher has chosen the questions independently and at random from among all the questions she could have chosen. When the student knows the correct answer to a given question, he has a 98% chance of marking it correctly. When he does not know the answer, he answers by marking...
Write a program in Java that: 1. will prompt user with a menu that contains options...
Write a program in Java that: 1. will prompt user with a menu that contains options to: a. Add a To-Do Item to a todo list. A To-Do Item contains: i. An arbitrary reference number (4; 44,004; etc.) ii. A text description of the item ("Pick up dry cleaning", etc.) iii. A priority level (1, 2, 3, 4, or 5) b. View an item in the list (based on its reference number) c. Delete an item from the list (based...
Richard has just been given a 4-question multiple-choice quiz in his history class. Each question has...
Richard has just been given a 4-question multiple-choice quiz in his history class. Each question has five answers, of which only one is correct. Since Richard has not attended class recently, he doesn't know any of the answers. Assuming that Richard guesses on all four questions, find the indicated probabilities. (Round your answers to three decimal places.) (a) What is the probability that he will answer all questions correctly? (b) What is the probability that he will answer all questions...
Richard has just been given a 4-question multiple-choice quiz in his history class. Each question has...
Richard has just been given a 4-question multiple-choice quiz in his history class. Each question has four answers, of which only one is correct. Since Richard has not attended class recently, he doesn't know any of the answers. Assuming that Richard guesses on all four questions, find the indicated probabilities. (Round your answers to three decimal places.) (a) What is the probability that he will answer all questions correctly? (b) What is the probability that he will answer all questions...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT